private static IEnumerable<BinaryAttachment> GetDistinctInstances() { var nameGenerator = new RegexLite(@"[A-Za-z0-9]{5,30}"); var random = new Random(); for (int i = 0; i < 10000; i++) foreach (var mimeType in MimeTypes.All) { var bytes = new byte[random.Next(0, 1000)]; random.NextBytes(bytes); yield return new BinaryAttachment(nameGenerator.GetRandomString(random), mimeType, bytes); } }
public void Construct_with_pattern(string input, string expected) { var pattern = new RegexLite(input); var random = new Random(); Assert.Multiple(() => { for (int i = 0; i < 100; i++) { string actual = pattern.GetRandomString(random); TestLog.WriteLine(actual); Assert.FullMatch(actual, expected); } }); }