public void Dispose_NullStream()
        {
            // Arrange
            StreamStorageContent content = new StreamStorageContent(null);

            // Act
            content.Dispose();

            // Assert
        }
        public void Dispose_MemoryStream()
        {
            using (MemoryStream stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 }))
            {
                // Arrange
                StreamStorageContent content = new StreamStorageContent(stream);

                // Act
                content.Dispose();

                // Assert
                Assert.Throws<ObjectDisposedException>(delegate { long l = stream.Length; });
            }
        }
 /// <summary>
 /// Saves the contents of a file to storage.
 /// </summary>
 /// <param name="sourceFile">The file to save.</param>
 /// <param name="destinationResourceUrl">The resource URL to save the contents to.</param>
 public static void SaveFileContents(this IStorage storage, string sourceFile, Uri destinationResourceUrl)
 {
     using (FileStream fileStream = File.OpenRead(sourceFile))
     {
         using (StreamStorageContent packageStorageContent = new StreamStorageContent(fileStream))
         {
             storage.Save(destinationResourceUrl, packageStorageContent, new CancellationToken()).Wait();
         }
     }
 }
 /// <summary>
 /// Saves the contents of a URL to storage.
 /// </summary>
 /// <param name="sourceUrl">The URL to download the contents from.</param>
 /// <param name="destinationResourceUrl">The resource URL to save the contents to.</param>
 public static void SaveUrlContents(this IStorage storage, Uri sourceUrl, Uri destinationResourceUrl)
 {
     using (WebClient client = new WebClient())
     {
         using (Stream downloadStream = client.OpenRead(sourceUrl))
         {
             using (StreamStorageContent packageStorageContent = new StreamStorageContent(downloadStream))
             {
                 storage.Save(destinationResourceUrl, packageStorageContent, new CancellationToken()).Wait();
             }
         }
     }
 }