コード例 #1
0
        public void CatchEmptyListsException()
        {
            var expectedExceptionMessage = "No lists were found";
            var factory   = new MergeFactory <int>();
            var exception = Should.Throw <InvalidOperationException>(() => factory.Merge());

            exception.Message.ShouldBe(expectedExceptionMessage);
        }
コード例 #2
0
        public void MergeTestOneList_Positive()
        {
            var list_1 = new LinkedList <int>(new[] { 1, 3, 5, 7 });

            var expectedResultSource = list_1.ToList();
            var expectedResult       = new LinkedList <int>(expectedResultSource);

            var factory      = new MergeFactory <int>(list_1);
            var actualResult = factory.Merge();

            actualResult.ShouldBe(expectedResult);
        }
コード例 #3
0
        public void MergeTestSimilarLists_Positive()
        {
            var list_1 = new LinkedList <int>(new[] { 1, 3, 5, 7 });
            var list_2 = new LinkedList <int>(new[] { 1, 3, 5, 7 });
            var list_3 = new LinkedList <int>(new[] { 1, 3, 5, 7 });

            var expectedResultSource = list_1.Concat(list_2).Concat(list_3).OrderBy(x => x).ToList();
            var expectedResult       = new LinkedList <int>(expectedResultSource);

            var factory      = new MergeFactory <int>(list_1, list_2, list_3);
            var actualResult = factory.Merge();

            actualResult.ShouldBe(expectedResult);
        }