Ejemplo n.º 1
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsNothing_ForEmptySequence()
        {
            var array = new int[] { };

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