Exemple #1
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsNothing_ForEmptySequence()
        {
            var array = new int[] { };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 1)
                );
        }
Exemple #2
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsNothing_IfThreePartitionsNotPossible()
        {
            var array = new[] { 2, 1, 3, 2, 5 };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 3)
                );
        }
Exemple #3
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsEverything_IfOnlyOnePartition()
        {
            var array = new[] { 1, 2, 3, 4, 5 };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 1),
                new[] { 1, 2, 3, 4, 5 });
        }
Exemple #4
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsTwoPartitions_IfPossible()
        {
            var array = new[] { 2, 1, 3, 2 };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 2),
                new[] { 2, 2 },
                new[] { 1, 3 }
                );
        }
Exemple #5
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsEmptyArrayAndAll_ForNegativeZeroing()
        {
            var array = new[] { -1, 1 };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 2),
                new[] { -1, 1 },
                new int[] { }
                );
        }
Exemple #6
0
 public void SplitIntoSubsetsOfEqualValue_ThrowsException_IfAggregatorIsNull()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           Set.SplitIntoSubsetsOfEqualValue(new[] { 1 }, null, Comparer <int> .Default, 1));
 }
Exemple #7
0
 public void SplitIntoSubsetsOfEqualValue_ThrowsException_IsCountOfPartitionsLessThanOne()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                 Set.SplitIntoSubsetsOfEqualValue(new[] { 1 }, IntegerAggregator, Comparer <int> .Default, 0));
 }
Exemple #8
0
 public void SplitIntoSubsetsOfEqualValue_ThrowsException_IfSequenceIsNull()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           Set.SplitIntoSubsetsOfEqualValue(null, IntegerAggregator, Comparer <int> .Default, 1));
 }
Exemple #9
0
 public void SplitIntoSubsetsOfEqualValue_ThrowsException_IfComparerIsNull()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           Set.SplitIntoSubsetsOfEqualValue(new[] { 1 }, IntegerAggregator, null, 1));
 }