aspnetcore/test/Microsoft.AspNetCore.Routin.../Constraints/MaxRouteConstraintTests.cs

28 lines
828 B
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Routing.Constraints;
using Xunit;
namespace Microsoft.AspNetCore.Routing.Tests
{
public class MaxRouteConstraintTests
{
[Theory]
[InlineData(3, 2, true)]
[InlineData(3, 3, true)]
[InlineData(3, 4, false)]
public void MaxRouteConstraint_ApplyConstraint(long max, int parameterValue, bool expected)
{
// Arrange
var constraint = new MaxRouteConstraint(max);
// Act
var actual = ConstraintsTestHelper.TestConstraint(constraint, parameterValue);
// Assert
Assert.Equal(expected, actual);
}
}
}