Ejemplo n.º 1
0
        public void Find_ReturnsIndexesWithExpectedOrdering()
        {
            SortedTable <int> table = new SortedTable <int>();

            table.Add(1);
            table.Add(2);
            table.Add(3);

            SortedTable <int> .Index index1 = table.Find(1);
            SortedTable <int> .Index index2 = table.Find(2);
            SortedTable <int> .Index index3 = table.Find(3);

            Assert.True(index1.CompareTo(index1) == 0);
            Assert.True(index1.Equals(index1));
            Assert.False(index1.Equals(index2));
            Assert.True(index1.CompareTo(index2) < 0);
            Assert.True(index1.CompareTo(index3) < 0);

            Assert.True(index2.CompareTo(index1) > 0);
            Assert.True(index2.CompareTo(index2) == 0);
            Assert.True(index2.Equals(index2));
            Assert.False(index2.Equals(index3));
            Assert.True(index2.CompareTo(index3) < 0);

            Assert.True(index3.CompareTo(index1) > 0);
            Assert.True(index3.CompareTo(index2) > 0);
            Assert.True(index3.CompareTo(index3) == 0);
            Assert.True(index3.Equals(index3));
            Assert.False(index3.Equals(index1));
        }