Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@ -141,7 +141,6 @@ namespace MonoTests.System.IO
#if !MOBILE
[Test]
[Category ("NotWorking")]
public void IsReadOnly ()
{
string path = TempFolder + DSC + "FIT.IsReadOnly.Test";
@ -596,6 +595,8 @@ namespace MonoTests.System.IO
try {
FileInfo info = new FileInfo (path);
Assert.IsFalse (info.Exists, "#1");
info.Delete ();
Assert.IsFalse (info.Exists, "#1a");
info.Create ().Close ();
info = new FileInfo (path);
Assert.IsTrue (info.Exists, "#2");
@ -651,6 +652,35 @@ namespace MonoTests.System.IO
}
}
[Test] //Covers #18361
public void MoveTo_SameName ()
{
string name = "FIT.MoveTo.SameName.Test";
string path1 = TempFolder + DSC + name;
string path2 = TempFolder + DSC + "same";
Directory.CreateDirectory (path2);
path2 += DSC + name;
DeleteFile (path1);
DeleteFile (path2);
try {
File.Create (path1).Close ();
FileInfo info1 = new FileInfo (path1);
FileInfo info2 = new FileInfo (path2);
Assert.IsTrue (info1.Exists, "#A1");
Assert.IsFalse (info2.Exists, "#A2");
info1.MoveTo (path2);
info1 = new FileInfo (path1);
info2 = new FileInfo (path2);
Assert.IsFalse (info1.Exists, "#B1");
Assert.IsTrue (info2.Exists, "#B2");
} finally {
DeleteFile (path1);
DeleteFile (path2);
}
}
[Test]
public void MoveTo_DestFileName_AlreadyExists ()
{
@ -728,9 +758,9 @@ namespace MonoTests.System.IO
try {
info.MoveTo (destFile);
Assert.Fail ("#1");
} catch (DirectoryNotFoundException ex) {
} catch (FileNotFoundException ex) {
// Could not find a part of the path
Assert.AreEqual (typeof (DirectoryNotFoundException), ex.GetType (), "#2");
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
}
@ -853,6 +883,29 @@ namespace MonoTests.System.IO
}
}
[Test] //Covers #38796
public void ToStringAfterMoveTo ()
{
string name1 = "FIT.ToStringAfterMoveTo.Test";
string name2 = "FIT.ToStringAfterMoveTo.Test.Alt";
string path1 = TempFolder + DSC + name1;
string path2 = TempFolder + DSC + name2;
DeleteFile (path1);
DeleteFile (path2);
try {
File.Create (path1).Close ();
FileInfo info = new FileInfo (path1);
Assert.AreEqual (path1, info.ToString (), "#A");
info.MoveTo (path2);
Assert.AreEqual (path2, info.ToString (), "#B");
} finally {
DeleteFile (path1);
DeleteFile (path2);
}
}
#if !MOBILE
[Test]
public void Replace1 ()