Create a large file of 100 lines to upload
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace AltSerializer.Tests
{
public static class Common
{
const int bigDummyFileKilobyte = 1024; //Create a 1MB File
/// <summary>
/// Create a large file of 100 lines to upload
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public static string CreateBigDummyFile(string path, string fileName, int lines)
{
StringBuilder sb = new StringBuilder(lines * bigDummyFileKilobyte);
path = System.IO.Path.Combine(path, fileName);
for (long i = 0; i < bigDummyFileKilobyte * 10; i++)
{
sb.AppendFormat("This is text line {0} \r\n", i);
}
System.IO.File.WriteAllText(path, sb.ToString());
return path;
}
}
}
Related examples in the same category