예제 #1
0
        public void ShouldFindSolutionForGivenSet()
        {
            var result = PerfectSumSolver.Solve(new HashSet <int>()
            {
                1, 5, 20, 50, 100
            }, 150);

            result.HasValue.ShouldBe(true);
            result.Contains((50, 100)).ShouldBe(true);
        }
예제 #2
0
        public void ShouldFindNoSolutionsWithEmptySet()
        {
            var result = PerfectSumSolver.Solve(new HashSet <int>(), 0);

            result.HasValue.ShouldBe(false);
        }
예제 #3
0
 public void ShouldThrowArgumentNullExceptionWhenGivenNullSet()
 {
     Should.Throw <ArgumentNullException>(() => PerfectSumSolver.Solve(null, 0));
 }