2008-01-17 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Thu, 17 Jan 2008 22:01:27 +0000 (22:01 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Thu, 17 Jan 2008 22:01:27 +0000 (22:01 -0000)
* IsolatedStorageFileTest.cs: Added test case against regression of
bug #354539

svn path=/trunk/mcs/; revision=93210

mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog
mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs

index 5da14ca7a2660b4ba9910fc3949476fcb5838a4d..0b9564130ff15600a0ebbcff3d6555b49917e280 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-17  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * IsolatedStorageFileTest.cs: Added test case against regression of
+       bug #354539
+
 2007-11-06  Sebastien Pouliot  <sebastien@ximian.com>
 
        * IsolatedStorageFileStreamTest.cs: Test case for rooted paths by Jay
index 9f7d3e7d0dd51d99d6165a539bf934b194575cbe..411db7957924a4410d98d4ac6aa11cc2a84626ff 100644 (file)
@@ -29,6 +29,7 @@
 
 using System;
 using System.Collections;
+using System.IO;
 using System.IO.IsolatedStorage;
 using System.Reflection;
 using System.Security;
@@ -386,5 +387,29 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        ae.AddHost (new Zone (SecurityZone.Internet));
                        IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, null, null, ae, typeof (Zone));
                }
+
+               [Test]
+               public void RegressionBNC354539 ()
+               {
+                       string filename = "test-bnc-354539";
+                       byte[] expected = new byte[] { 0x01, 0x42, 0x00 };
+                       byte[] actual = new byte [expected.Length];
+
+                       using (IsolatedStorageFile file = IsolatedStorageFile.GetStore (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) {
+                               using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream (filename, FileMode.Create, FileAccess.Write, FileShare.None, file)) {
+                                       stream.Write (expected, 0, expected.Length);
+                               }
+                       }
+
+                       using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForAssembly ()) {
+                               using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream (filename, FileMode.Open, FileAccess.Read, FileShare.Read, file)) {
+                                       stream.Read (actual, 0, actual.Length);
+                               }
+
+                               file.DeleteFile (filename);
+                       }
+                       
+                       Assert.AreEqual (expected, actual);
+               }
        }
 }