public void Should_Upload_Object_Successfully()
{
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test", Guid.NewGuid().ToString().Replace("-", string.Empty) + ".tmp");
const string content = "test content";
try
{
using (MemoryStream memoryStream = new MemoryStream())
{
using (TextWriter writer = new StreamWriter(memoryStream))
{
writer.Write(content);
writer.Flush();
FileSystemStorageService storageService = new FileSystemStorageService();
storageService.UploadObject(
new UploadRequest
{
Uri = new Uri(path),
InputStream = memoryStream,
CreateDirectory = true
});
Assert.IsTrue(File.Exists(path));
Assert.AreEqual(content, File.ReadAllText(path));
}
}
}
finally
{
if (File.Exists(path))
{
File.Delete(path);
}
}
}
}