Permalink
Browse files

Fixed bug in OpenInput/OpenOutput

  • Loading branch information...
kmees committed Mar 13, 2013
1 parent 4713414 commit 8860c91d354cc63ee90a53b1cc239db4ea01aed4
@@ -46,15 +46,15 @@ public Stream OpenInputFileStream(string path)
{
path = GetFullPath(path);
- if(!File.Exists(path)) throw new FileNotFoundException("", path);
- return File.OpenWrite(path);
+ return File.OpenRead(path);
}
public Stream OpenOutputFileStream(string path)
{
path = GetFullPath(path);
- return File.OpenRead(path);
+ if(!File.Exists(path)) throw new FileNotFoundException("", path);
+ return File.OpenWrite(path);
}
public string GetFullPath(string path)
@@ -137,7 +137,7 @@ public void OpenInputFileStream_CanWriteToStream()
using (var stream = Sut.OpenInputFileStream("lorem.txt"))
{
- stream.CanWrite.Should().BeTrue();
+ stream.CanRead.Should().BeTrue();
}
}
@@ -172,7 +172,7 @@ public void OpenOutputFileStream_CanReadFromStream()
using (var stream = Sut.OpenOutputFileStream("lorem.txt"))
{
- stream.CanRead.Should().BeTrue();
+ stream.CanWrite.Should().BeTrue();
}
}

0 comments on commit 8860c91

Please sign in to comment.