public void GetOptimalFullCoverage_ReturnsSingleSet()
        {
            var set = new HashSet <int> {
                1, 2, 3, 4
            };
            var coverage = Set.GetOptimalFullCoverage(new[] { set }, EqualityComparer <int> .Default);

            TestHelper.AssertSequence(
                coverage, set);
        }
        public void GetOptimalFullCoverage_ReturnsGreatestOneFirst()
        {
            var set1 = new HashSet <int> {
                1, 4
            };
            var set2 = new HashSet <int> {
                2, 3, 1
            };

            var coverage = Set.GetOptimalFullCoverage(new[] { set1, set2 }, EqualityComparer <int> .Default);

            TestHelper.AssertSequence(coverage, set2, set1);
        }
        public void GetOptimalFullCoverage_ReturnsBestChoiceOnly()
        {
            var set1 = new HashSet <int> {
                1, 2
            };
            var set2 = new HashSet <int> {
                2
            };

            var coverage = Set.GetOptimalFullCoverage(new[] { set1, set2 }, EqualityComparer <int> .Default);

            TestHelper.AssertSequence(
                coverage, set1);
        }
        public void GetOptimalFullCoverage_ReturnsTwoSets()
        {
            var set1 = new HashSet <int> {
                1, 2
            };
            var set2 = new HashSet <int> {
                2, 3
            };
            var set3 = new HashSet <int> {
                1, 3
            };

            var coverage = Set.GetOptimalFullCoverage(new[] { set1, set2, set3 }, EqualityComparer <int> .Default);

            TestHelper.AssertSequence(coverage, set1, set2);
        }
        public void GetOptimalFullCoverage_ReturnsIndividualSets_IfNoIntersectionFound()
        {
            var set1 = new HashSet <int> {
                1
            };
            var set2 = new HashSet <int> {
                2
            };
            var set3 = new HashSet <int> {
                3
            };

            var coverage = Set.GetOptimalFullCoverage(new[] { set1, set2, set3 }, EqualityComparer <int> .Default);

            TestHelper.AssertSequence(
                coverage, set1, set2, set3);
        }
        public void GetOptimalFullCoverage_ReturnsNothing_ForEmptySets()
        {
            var coverage = Set.GetOptimalFullCoverage(new ISet <int>[] { }, EqualityComparer <int> .Default);

            TestHelper.AssertSequence(coverage);
        }
 public void GetOptimalFullCoverage_ThrowsException_ForNullSets()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           Set.GetOptimalFullCoverage(null, EqualityComparer <int> .Default));
 }
 public void GetOptimalFullCoverage_ThrowsException_ForEqualityComparer()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           Set.GetOptimalFullCoverage(new ISet <int>[] { }, null));
 }