Esempio n. 1
0
        public int Compare(MergeSource x, MergeSource y)
        {
            var result = _comparer.Compare(x.Current, y.Current);

            if (result == 0)
            {
                result = string.CompareOrdinal(x.FileName, y.FileName);
            }

            return(result);
        }
Esempio n. 2
0
        public static void FileSorted(string path, CompositeStringComparer comparer)
        {
            CompositeString prevComposite = new CompositeString();

            Assert.True(File.Exists(path));
            using (var reader = new StreamReader(path))
            {
                string          currentLine      = null;
                CompositeString currentComposite = new CompositeString();
                while ((currentLine = reader.ReadLine()) != null)
                {
                    currentComposite.Init(currentLine);
                    Assert.LessOrEqual(comparer.Compare(prevComposite, currentComposite), 0);
                    prevComposite = currentComposite;
                }
            }
        }