public void OpenText() { string tempFile = Path.GetTempFileName(); string expected = "This is a test."; ExtendedFileInfo efi = new ExtendedFileInfo(tempFile); Assert.IsNotNull(efi); File.AppendAllText(tempFile, expected); string actual = String.Empty; using (StreamReader stream = efi.OpenText()) { Assert.IsTrue(stream.BaseStream.CanRead); Assert.IsFalse(stream.BaseStream.CanWrite); Assert.IsTrue(stream.CurrentEncoding == Encoding.UTF8); actual = stream.ReadToEnd(); } Assert.AreEqual(expected, actual); }