/// <summary> /// Generates a file of random strings /// </summary> /// <param name="size">Size in bytes</param> /// <param name="fileName">File path</param> static void GenerateFile(long size, string fileName, IDataStructure dataStructure) { long generatedFileSize = 0; using (var fileStream = new StreamWriter(fileName)) { while (generatedFileSize < size) { var rndDataString = dataStructure.GetRandomData(); // write to file generatedFileSize += rndDataString.Length; fileStream.Write(rndDataString); } } }