public void ReturnValidPin() { // Arrange var pinLength = 4; // Act: We can mock the Func<> params var result = _randomPinService.GeneratePin(pinLength); // Assert Assert.IsNotNull(result, "We must have a pin"); Assert.IsTrue(result.Length == 4, "Pin must be 4 digits"); }
public HashSet <string> GetPins(int batchSize, int pinLength) { // Must not exceed max combinations for the length of the pin if (batchSize < _randomPinService.MaxPinCombinations(pinLength)) { var pinHashset = new HashSet <string>(); while (pinHashset.Count() < batchSize) { pinHashset.Add(_randomPinService.GeneratePin(pinLength)); } return(pinHashset); } throw new ArgumentOutOfRangeException("Batch size exceeds max combinations for pin length"); }