}
#endif // TARGET_JVM
+ [Category("TargetJvmNotSupported")] // File sharing not supported for TARGET_JVM
[Test, ExpectedException (typeof (IOException))]
public void CtorIOException ()
{
}
[Test]
+ [Category("TargetJvmNotSupported")] // File sharing not supported for TARGET_JVM
[ExpectedException (typeof (IOException))]
public void CtorAccess1Read2Write ()
{
string fn = Path.Combine (TempFolder, "temp");
- FileStream fs = null;
+ FileStream fs1 = null;
+ FileStream fs2 = null;
try {
if (!File.Exists (fn)) {
using (TextWriter tw = File.CreateText (fn)) {
tw.Write ("FOO");
}
}
- fs = new FileStream (fn, FileMode.Open, FileAccess.Read);
- fs = new FileStream (fn, FileMode.Create, FileAccess.Write);
+ fs1 = new FileStream (fn, FileMode.Open, FileAccess.Read);
+ fs2 = new FileStream (fn, FileMode.Create, FileAccess.Write);
} finally {
- if (fs != null)
- fs.Close ();
+ if (fs1 != null)
+ fs1.Close ();
+ if (fs2 != null)
+ fs2.Close ();
if (File.Exists (fn))
File.Delete (fn);
}
}
[Test]
+ [Category("TargetJvmNotSupported")] // File sharing not supported for TARGET_JVM
[ExpectedException (typeof (IOException))]
public void CtorAccess1Write2Write ()
{
string fn = Path.Combine (TempFolder, "temp");
- FileStream fs = null;
+ FileStream fs1 = null;
+ FileStream fs2 = null;
try {
if (File.Exists (fn))
File.Delete (fn);
- fs = new FileStream (fn, FileMode.Create, FileAccess.Write);
- fs = new FileStream (fn, FileMode.Create, FileAccess.Write);
+ fs1 = new FileStream (fn, FileMode.Create, FileAccess.Write);
+ fs2 = new FileStream (fn, FileMode.Create, FileAccess.Write);
} finally {
- if (fs != null)
- fs.Close ();
+ if (fs1 != null)
+ fs1.Close ();
+ if (fs2 != null)
+ fs2.Close ();
if (File.Exists (fn))
File.Delete (fn);
}
}
}
+#if NET_2_0
+ [Test] // bug #79250
+ public void FileShare_Delete ()
+ {
+ string fn = Path.Combine (TempFolder, "temp");
+
+ using (Stream s = new FileStream (fn, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Delete)) {
+ s.Write (new byte [1] { 0x5 }, 0, 1);
+ File.Delete (fn);
+ }
+
+ using (Stream s = new FileStream (fn, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete)) {
+ s.Write (new byte [1] { 0x5 }, 0, 1);
+ File.Delete (fn);
+ }
+
+ using (Stream s = new FileStream (fn, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write | FileShare.Delete)) {
+ s.Write (new byte [1] { 0x5 }, 0, 1);
+ File.Delete (fn);
+ }
+
+ using (Stream s = new FileStream (fn, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read | FileShare.Delete)) {
+ s.Write (new byte [1] { 0x5 }, 0, 1);
+ File.Delete (fn);
+ }
+
+ using (Stream s = new FileStream (fn, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Inheritable | FileShare.Delete)) {
+ s.Write (new byte [1] { 0x5 }, 0, 1);
+ File.Delete (fn);
+ }
+ }
+#endif
+
[Test]
public void Write ()
{
DeleteFile (path);
}
+ [Category("TargetJvmNotSupported")] // File locking not supported for TARGET_JVM
public void TestLock ()
{
string path = TempFolder + Path.DirectorySeparatorChar + "TestLock";
}
[Test]
+ [Category("TargetJvmNotSupported")] // Async IO not supported for TARGET_JVM
[ExpectedException (typeof (ObjectDisposedException))]
public void BeginRead_Disposed ()
{
}
[Test]
+ [Category("TargetJvmNotSupported")] // Async IO not supported for TARGET_JVM
[ExpectedException (typeof (ObjectDisposedException))]
public void BeginWrite_Disposed ()
{
}
[Test]
+ [Category("TargetJvmNotSupported")] // File locking not supported for TARGET_JVM
[ExpectedException (typeof (ObjectDisposedException))]
public void Lock_Disposed ()
{
}
[Test]
+ [Category("TargetJvmNotSupported")] // File locking not supported for TARGET_JVM
[ExpectedException (typeof (ObjectDisposedException))]
public void Unlock_Disposed ()
{
}
#if NET_2_0
- [Test] public void DeleteOnClose ()
+ [Category("TargetJvmNotSupported")] // FileOptions.DeleteOnClose not supported for TARGET_JVM
+ [Test]
+ public void DeleteOnClose ()
{
string path = TempFolder + DSC + "created.txt";
DeleteFile (path);
#endif
}
}
-