Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ConstraintsTestHelper.cs « Constraints « UnitTests « test « Routing « Http « src - github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6a77eb095ba6ecde23e5d44f1c4d1b647725c311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 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 Microsoft.AspNetCore.Http;
using Moq;

namespace Microsoft.AspNetCore.Routing.Tests
{
    public class ConstraintsTestHelper
    {
        public static bool TestConstraint(IRouteConstraint constraint, object value)
        {
            var parameterName = "fake";
            var values = new RouteValueDictionary() { { parameterName, value } };
            var routeDirection = RouteDirection.IncomingRequest;
            return constraint.Match(httpContext: null, route: null, parameterName, values, routeDirection);
        }
    }
}