public void Open() { string tempFile = Path.GetTempFileName(); ExtendedFileInfo efi = new ExtendedFileInfo(tempFile); using (FileStream stream = efi.Open(FileMode.Open)) { Assert.IsNotNull(stream); Assert.IsTrue(stream.Length == 0); } tempFile = Path.GetTempFileName(); efi = new ExtendedFileInfo(tempFile); using (FileStream stream = efi.Open(FileMode.Open, FileAccess.Read)) { Assert.IsNotNull(stream); Assert.IsTrue(stream.Length == 0); Assert.IsTrue(stream.CanRead); Assert.IsFalse(stream.CanWrite); } tempFile = Path.GetTempFileName(); efi = new ExtendedFileInfo(tempFile); using (FileStream stream = efi.Open(FileMode.Open, FileAccess.Read, FileShare.None)) { Assert.IsNotNull(stream); Assert.IsTrue(stream.Length == 0); Assert.IsTrue(stream.CanRead); Assert.IsFalse(stream.CanWrite); try { File.Open(tempFile, FileMode.Open); } catch (IOException) { Assert.IsTrue(true); } catch (Exception e) { Assert.Fail(e.Message); } } }