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

RouteValueEqualityComparerTest.cs « UnitTests « test « Routing « Http « src - github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b00e812340528c918c4a91e624b82a53b230b3a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Xunit;

namespace Microsoft.AspNetCore.Routing
{
    public class RouteValueEqualityComparerTest
    {
        private readonly RouteValueEqualityComparer _comparer;

        public RouteValueEqualityComparerTest()
        {
            _comparer = new RouteValueEqualityComparer();
        }

        [Theory]
        [InlineData(5, 7, false)]
        [InlineData("foo", "foo", true)]
        [InlineData("foo", "FoO", true)]
        [InlineData("foo", "boo", false)]
        [InlineData("7", 7, true)]
        [InlineData(7, "7", true)]
        [InlineData(5.7d, 5.7d, true)]
        [InlineData(null, null, true)]
        [InlineData(null, "foo", false)]
        [InlineData("foo", null, false)]
        [InlineData(null, "", true)]
        [InlineData("", null, true)]
        [InlineData("", "", true)]
        [InlineData("", "foo", false)]
        [InlineData("foo", "", false)]
        [InlineData(true, true, true)]
        [InlineData(true, false, false)]
        public void EqualsTest(object x, object y, bool expected)
        {
            var actual = _comparer.Equals(x, y);
            Assert.Equal(expected, actual);
        }
    }
}