System.Dynamic.Tests.CallInfoTests.HashCodeBasedOnEquality C# (CSharp) Méthode

HashCodeBasedOnEquality() private méthode

private HashCodeBasedOnEquality ( ) : void
Résultat void
        public void HashCodeBasedOnEquality()
        {
            string[] names = new[] {"foo", "bar", "baz", "quux", "quuux"};
            for (int i = 0; i <= names.Length; ++i)
            {
                for (int j = 0; j != 3; ++j)
                {
                    for (int x = 0; x <= names.Length; ++x)
                    {
                        for (int y = 0; y != 3; ++y)
                        {
                            var info0 = new CallInfo(i + j, names.Take(i));
                            var info1 = new CallInfo(x + y, names.Take(x));
                            if (info0.Equals(info1))
                            {
                                Assert.Equal(info0.GetHashCode(), info1.GetHashCode());
                            }
                            else
                            {
                                // Failure at this point is not definitely a bug,
                                // but should be considered a concern unless it can be
                                // convincingly ruled a fluke.
                                Assert.NotEqual(info0.GetHashCode(), info1.GetHashCode());
                            }
                        }
                    }
                }
            }
        }