public void KnownComparisons() { var s1_lower = new Skip { Number = 1, What = Skip.SkipType.Day }; var s1_upper = new Skip { Number = 10, What = Skip.SkipType.Day }; var s2_lower = new Skip { Number = 2, What = Skip.SkipType.Week }; var s2_upper = new Skip { Number = 100, What = Skip.SkipType.Week }; Assert.True(s1_lower.Compare(s1_lower, s1_upper)==-1); Assert.True(s1_upper.Compare(s1_upper, s1_lower) == 1); Assert.True(s2_lower.Compare(s2_lower, s2_upper) == -1); Assert.True(s2_upper.Compare(s2_upper, s2_lower) == 1); Assert.True(s1_lower.Compare(s1_lower, s2_lower) == -1); Assert.True(s1_lower.Compare(s2_lower, s2_upper) == -1); Assert.True(s1_lower.Compare(s1_upper, s2_upper) == -1); List<Skip> unsorted = new List<Skip> { s1_lower, s1_upper, s2_lower, s2_upper }; unsorted.Sort(); var sorted = unsorted; Assert.Equal(sorted[0], s1_lower); Assert.Equal(sorted[1], s1_upper); Assert.Equal(sorted[2], s2_lower); Assert.Equal(sorted[3], s2_upper); }
public void BasicSkipObjectComparison() { var s1 = new Skip { Number = 1, What = Skip.SkipType.Day }; Assert.Equal(s1, s1); Assert.Equal(0, s1.Compare(s1,s1)); }