public void Should_Download_Object_Successfully()
{
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString().Replace("-", string.Empty) + ".tmp");
const string content = "test content";
try
{
File.WriteAllText(path, content);
FileSystemStorageService storageService = new FileSystemStorageService();
Uri downloadUri = new Uri(path);
var download = storageService.DownloadObject(downloadUri);
Assert.AreEqual(download.Uri, downloadUri);
using (TextReader reader = new StreamReader(download.ResponseStream))
{
string contentFromStream = reader.ReadToEnd();
Assert.AreEqual(content, contentFromStream);
}
}
finally
{
if (File.Exists(path))
{
File.Delete(path);
}
}
}