public void Compare_WithCoordinates_ComparesPositions()
        {
            var comparer = new PositionComparer(100);
            // 100010
            var a = new Position(10, 100);
            //  10100
            var b = new Position(100, 10);

            var result = comparer.Compare(a, b);

            Assert.AreEqual(1, result);

            result = comparer.Compare(b, a);

            Assert.AreEqual(-1, result);
        }
 private static string SelectBestPositionValue(IEnumerable<string> positions)
 {
     var comparer = new PositionComparer();
     return positions.Aggregate(string.Empty,
                                (agg, pos) =>
                                string.IsNullOrEmpty(agg)
                                    ? pos
                                    : string.IsNullOrEmpty(pos)
                                          ? agg
                                          : comparer.Compare(agg, pos) < 0 ? agg : pos);
 }
 private static bool IsInside(PositionComparer comparer, Range range, Position position)
 {
     return(comparer.Compare(position, range.Start) >= 0 &&
            comparer.Compare(position, range.End) <= 0);
 }
 private static bool IsEnclosedBy(PositionComparer comparer, Range current, Range tested)
 {
     return(comparer.Compare(tested.Start, current.Start) >= 0 &&
            comparer.Compare(tested.End, current.End) <= 0);
 }