public void NoDenominationsProduceNoSolution() { var strategy = new GreedyStrategy(); var result = strategy.Solve(1, Array.Empty <int>()); Assert.That(result, Is.Not.Null, "The result should have been returned."); Assert.That(result, Is.Empty, "The result should not contain any denominations."); }
public void NoValueProducesNoSolution(int value) { var strategy = new GreedyStrategy(); var result = strategy.Solve(value, new[] { 1, 5, 10, 25 }); Assert.That(result, Is.Not.Null, "The result should have been returned."); Assert.That(result, Is.Empty, "The result should not contain any denominations."); }
public void UnsolvableCombinationsProduceNoSolution(int value, int[] denominations) { var strategy = new GreedyStrategy(); var result = strategy.Solve(value, denominations); Assert.That(result, Is.Not.Null, "The result should have been returned."); Assert.That(result, Is.Empty, "The result should not contain any denominations."); }
public void LocalMaximumCasesProduceIncorrectSolutions(int value, int[] denominations, IReadOnlyList <CoinUse> expectedResult) { var strategy = new GreedyStrategy(); var result = strategy.Solve(value, denominations); Assert.That(result, Is.Not.Null, "The result should have been returned."); Assert.That(result.IsEquivalentTo(expectedResult), Is.True, "The result should have matched the expectation."); }