Hi,
FileInfo.Exists() returns false in the below scenario.
1. FileInfo info = new FileInfo (path);
2. AssertEquals ("test#01", false, info.Exists); //--> returns "false" 3. info.Create(); 4. AssertEquals ("Exits - test#02", true, info.Exists); //--> returns "false" is this the expected behavior ?
CODE SNIPPET:
[Test]
public void Read(){ string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
string path = TempFolder + "/FA.Read.Test"; DeleteFile (path); try { FileInfo info = new FileInfo (path); AssertEquals ("test#01", false, info.Exists); info.Create(); AssertEquals ("Exits - test#02", true, info.Exists); FileStream fStream = info.Open(FileMode.Open,FileAccess.Read); AssertEquals ("test#03", true, fStream.CanRead); AssertEquals ("test#04", false, fStream.CanWrite); AssertEquals ("test#05", true, fStream.CanSeek); fStream.Close(); } &nbs p; finally { DeleteFile (path); } } thanks,
Rathna. |