Imported Upstream version 5.8.0.88

Former-commit-id: 4b7216ffda08448e562271ce733688e761120fc5
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-11-28 19:36:51 +00:00
parent 7d05485754
commit 6123a772ed
277 changed files with 4817 additions and 941 deletions

View File

@ -18,15 +18,20 @@ namespace MonoTests.System.IO
[TestFixture]
public class StreamReaderTest
{
static string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
private string _codeFileName = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
private string _tmpFolder;
private string _codeFileName;
private const string TestString = "Hello World!";
[SetUp]
public void SetUp ()
{
if (!Directory.Exists (TempFolder))
Directory.CreateDirectory (TempFolder);
_tmpFolder = Path.GetTempFileName ();
if (File.Exists (_tmpFolder))
File.Delete (_tmpFolder);
_codeFileName = _tmpFolder + Path.DirectorySeparatorChar + "AFile.txt";
if (!Directory.Exists (_tmpFolder))
Directory.CreateDirectory (_tmpFolder);
if (!File.Exists (_codeFileName))
File.Create (_codeFileName).Close ();
@ -35,8 +40,8 @@ public class StreamReaderTest
[TearDown]
public void TearDown ()
{
if (Directory.Exists (TempFolder))
Directory.Delete (TempFolder, true);
if (Directory.Exists (_tmpFolder))
Directory.Delete (_tmpFolder, true);
}
@ -245,7 +250,7 @@ public class StreamReaderTest
{
bool errorThrown = false;
try {
new StreamReader(TempFolder + "/nonexistentfile", false);
new StreamReader(_tmpFolder + "/nonexistentfile", false);
} catch (FileNotFoundException) {
errorThrown = true;
} catch (Exception e) {
@ -256,7 +261,7 @@ public class StreamReaderTest
{
bool errorThrown = false;
try {
new StreamReader(TempFolder + "/nonexistentdir/file", false);
new StreamReader(_tmpFolder + "/nonexistentdir/file", false);
} catch (DirectoryNotFoundException) {
errorThrown = true;
} catch (Exception e) {
@ -310,7 +315,7 @@ public class StreamReaderTest
{
bool errorThrown = false;
try {
new StreamReader(TempFolder + "/nonexistentfile", true);
new StreamReader(_tmpFolder + "/nonexistentfile", true);
} catch (FileNotFoundException) {
errorThrown = true;
} catch (Exception e) {
@ -321,7 +326,7 @@ public class StreamReaderTest
{
bool errorThrown = false;
try {
new StreamReader(TempFolder + "/nonexistentdir/file", true);
new StreamReader(_tmpFolder + "/nonexistentdir/file", true);
} catch (DirectoryNotFoundException) {
errorThrown = true;
} catch (Exception e) {