Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
 public void SeekUnseekableThrows()
 {
     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));
     }
 }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
 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
         AssertExtensions.Throws <ArgumentOutOfRangeException>("value", () => fs.Position = -1);
         // dispose checking happens first
         fs.Dispose();
         Assert.Throws <ObjectDisposedException>(() => fs.Position = 1);
     }
 }
Esempio n. 8
0
 public void SeekUnseekableThrows()
 {
     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));
     }
 }