コード例 #1
0
        public void AlignElements_NullDiffSections_ThrowsArgumentNullException()
        {
            IList <int> collection1 = new int[0];
            IList <int> collection2 = new int[0];
            IEnumerable <DiffSection> diffSections = null;
            IDiffElementAligner <int> aligner      = new BasicInsertDeleteDiffElementAligner <int>();

            Assert.Throws <ArgumentNullException>(() => Diff.AlignElements(collection1, collection2, diffSections, aligner));
        }
コード例 #2
0
        public void Align_NullCollection2_ThrowsArgumentNullException()
        {
            var aligner = new BasicInsertDeleteDiffElementAligner <int>();

            IList <int> collection1 = new List <int>();
            IList <int> collection2 = null;

            Assert.Throws <ArgumentNullException>(() => aligner.Align(collection1, 0, 1, collection2, 0, 1).ToArray());
        }
コード例 #3
0
        public void Align_ItemsOnlyInCollection2_OutputsInserts()
        {
            var aligner = new BasicInsertDeleteDiffElementAligner <int>();

            IList <int> collection1 = new List <int>();
            IList <int> collection2 = new List <int>
            {
                1,
                2,
                3
            };

            var elements = aligner.Align(collection1, 0, collection1.Count, collection2, 0, collection2.Count).ToArray();

            CollectionAssert.AreEqual(new[]
            {
                new DiffElement <int>(null, Option <int> .None, 0, 1, DiffOperation.Insert),
                new DiffElement <int>(null, Option <int> .None, 1, 2, DiffOperation.Insert),
                new DiffElement <int>(null, Option <int> .None, 2, 3, DiffOperation.Insert),
            }, elements);
        }