Assert.IsNotNull (isf.AssemblyIdentity, prefix + "AssemblyIdentity");
if ((isf.Scope & IsolatedStorageScope.Domain) != 0)
Assert.IsNotNull (isf.DomainIdentity, prefix + "DomainIdentity");
-#if NET_2_0
if ((isf.Scope & IsolatedStorageScope.Application) != 0)
Assert.IsNotNull (isf.ApplicationIdentity, prefix + "ApplicationIdentity");
-#endif
}
private void GetEnumerator (IsolatedStorageScope scope)
// giving more details is bad
GetEnumerator (IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain | IsolatedStorageScope.Roaming);
}
-#if NET_2_0
[Test]
public void GetEnumerator_Machine ()
{
// we can't enum application
GetEnumerator (IsolatedStorageScope.Application);
}
-#endif
[Test]
public void GetUserStoreForAssembly ()
{
object o = isf.DomainIdentity;
}
-#if NET_2_0
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void GetUserStoreForAssembly_ApplicationIdentity ()
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
object o = isf.ApplicationIdentity;
}
-#endif
[Test]
public void GetUserStoreForDomain ()
Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
}
-#if NET_2_0
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void GetUserStoreForDomain_ApplicationIdentity ()
object o = isf.DomainIdentity;
}
#endif
-#endif
-#if NET_4_0
// This is supposed to be working only in SL.
[Test]
[ExpectedException (typeof (NotSupportedException))]
{
IsolatedStorageFile.GetUserStoreForSite ();
}
-#endif
[Test]
public void GetStore_Domain_Zone ()
try {
isf.CreateDirectory (path);
}
-#if NET_4_0
catch (IsolatedStorageException ex) {
Assert.IsFalse (ex.Message.IndexOf (path) >= 0, "Message");
Assert.IsNull (ex.InnerException, "InnerException");
}
-#else
- catch (IOException ex) {
- Assert.AreEqual (typeof (IOException), ex.GetType (), "Type");
- // don't leak path information
- Assert.IsFalse (ex.Message.IndexOf (path) >= 0, "Message");
- Assert.IsNull (ex.InnerException, "InnerException");
- }
-#endif
}
}
}
[Test]
-#if NET_4_0
[ExpectedException (typeof (ArgumentException))]
-#else
- [ExpectedException (typeof (SecurityException))]
-#endif
public void GetFilesInSubdirs ()
{
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
}
-#if NET_4_0
[Test]
[ExpectedException (typeof (ArgumentException))]
public void GetDirsInSubDirs ()
isf.CreateDirectory ("subdir");
string [] dir_names = isf.GetDirectoryNames ("subdir/../*");
}
-#endif
[Test] // https://bugzilla.novell.com/show_bug.cgi?id=376188
public void CreateSubDirectory ()
} catch (ArgumentNullException) {
}
-#if NET_4_0
// We are getting an internal IndexOutOfRangeException in 2.0
// Not sure we want to mimic that one.
try {
Assert.Fail ("#Exc1");
} catch (IsolatedStorageException) {
}
-#endif
try {
isf.DeleteFile ("idontexist");
} catch (IsolatedStorageException) {
}
-#if NET_4_0
try {
isf.DeleteFile ("../../file");
Assert.Fail ("#Exc3");
} catch (IsolatedStorageException) {
}
-#endif
try {
isf.DeleteFile ("subdir/file");
}
}
-#if NET_4_0
[Test]
public void Remove ()
{
isf.MoveFile (" ", "file-new-new");
Assert.Fail ("#Exc2");
} catch (ArgumentException e) {
- Console.WriteLine (e);
}
try {
isf.DeleteDirectory ("dir1");
}
}
-#endif
[Test]
public void RootedDirectory ()
{