public void ShorthandGeneratorShouldProduceValidShorthands(int length, string pattern) { // Arrange var shorthandGenerator = new ShorthandGenerator(new Random()); // Act var shorthand = shorthandGenerator.GenerateShorthand(length, pattern); // Assert shorthand.All(pattern.Contains).Should().BeTrue(); shorthand.Length.Should().Be(length); }
public void ShorthandGeneratorShouldProduceUniqueShorthands(int length, string pattern) { // Arrange const int runs = 100000; var shorthandGenerator = new ShorthandGenerator(new Random()); var shorthands = new HashSet <string>(); // Act for (var i = 0; i < runs; i++) { shorthands.Add(shorthandGenerator.GenerateShorthand(length, pattern)); } // Assert shorthands.Count.Should().Be(runs); }