public void GetPositionUnseekableThrows() { using (FileStream fs = new UnseekableFileStream(GetTestFilePath(), FileMode.Create)) { Assert.Throws<NotSupportedException>(() => fs.Position); // dispose checking happens first fs.Dispose(); Assert.Throws<ObjectDisposedException>(() => fs.Position); } }
public void GetPositionUnseekableThrows() { using (FileStream fs = new UnseekableFileStream(GetTestFilePath(), FileMode.Create)) { Assert.Throws <NotSupportedException>(() => fs.Position); // dispose checking happens first fs.Dispose(); Assert.Throws <ObjectDisposedException>(() => fs.Position); } }
public void GetLengthUnseekableThrows() { string fileName = GetTestFilePath(); using (FileStream fs = new UnseekableFileStream(fileName, FileMode.Create)) { Assert.Throws<NotSupportedException>(() => fs.Length); // dispose checking happens first fs.Dispose(); Assert.Throws<ObjectDisposedException>(() => fs.Length); } }
public void GetLengthUnseekableThrows() { string fileName = GetTestFilePath(); using (FileStream fs = new UnseekableFileStream(fileName, FileMode.Create)) { Assert.Throws <NotSupportedException>(() => fs.Length); // dispose checking happens first fs.Dispose(); Assert.Throws <ObjectDisposedException>(() => fs.Length); } }
public void SetLengthUnseekableThrows() { using (FileStream fs = new UnseekableFileStream(GetTestFilePath(), FileMode.Create)) { Assert.Throws <NotSupportedException>(() => fs.Seek(1, SeekOrigin.Begin)); // no fast path Assert.Throws <NotSupportedException>(() => fs.Seek(fs.Position, SeekOrigin.Begin)); // parameter checking happens first Assert.Throws <ArgumentException>("origin", () => fs.Seek(0, ~SeekOrigin.Begin)); // dispose checking happens first fs.Dispose(); Assert.Throws <ObjectDisposedException>(() => fs.Seek(fs.Position, SeekOrigin.Begin)); } }
public void SetPositionUnseekableThrows() { using (FileStream fs = new UnseekableFileStream(GetTestFilePath(), FileMode.Create)) { Assert.Throws<NotSupportedException>(() => fs.Position = 1); // no fast path Assert.Throws<NotSupportedException>(() => fs.Position = fs.Position); // parameter checking happens first Assert.Throws<ArgumentOutOfRangeException>("value", () => fs.Position = -1); // dispose checking happens first fs.Dispose(); Assert.Throws<ObjectDisposedException>(() => fs.Position = 1); } }
public void SetLengthUnseekableThrows() { using (FileStream fs = new UnseekableFileStream(GetTestFilePath(), FileMode.Create)) { Assert.Throws<NotSupportedException>(() => fs.Seek(1, SeekOrigin.Begin)); // no fast path Assert.Throws<NotSupportedException>(() => fs.Seek(fs.Position, SeekOrigin.Begin)); // parameter checking happens first Assert.Throws<ArgumentException>("origin", () => fs.Seek(0, ~SeekOrigin.Begin)); // dispose checking happens first fs.Dispose(); Assert.Throws<ObjectDisposedException>(() => fs.Seek(fs.Position, SeekOrigin.Begin)); } }
public void SetPositionUnseekableThrows() { using (FileStream fs = new UnseekableFileStream(GetTestFilePath(), FileMode.Create)) { Assert.Throws <NotSupportedException>(() => fs.Position = 1); // no fast path Assert.Throws <NotSupportedException>(() => fs.Position = fs.Position); // parameter checking happens first Assert.Throws <ArgumentOutOfRangeException>("value", () => fs.Position = -1); // dispose checking happens first fs.Dispose(); Assert.Throws <ObjectDisposedException>(() => fs.Position = 1); } }