public static void MakeSelection( this Mock <ITextSelection> selection, NormalizedSnapshotSpanCollection col) { selection.Setup(x => x.Mode).Returns(TextSelectionMode.Box); selection.Setup(x => x.SelectedSpans).Returns(col); var start = col.Min(x => x.Start); var end = col.Min(x => x.End); selection .Setup(x => x.StreamSelectionSpan) .Returns(new VirtualSnapshotSpan(new SnapshotSpan(start, end))); }