コード例 #1
0
ファイル: SetLength.cs プロジェクト: layomia/dotnet_runtime
        public void GetLengthThrowsForUnseekableFileStream()
        {
            string fileName = GetTestFilePath();

            using (FileStream fs = new UnseekableFileStream(fileName, FileMode.Create))
            {
                Assert.Throws <NotSupportedException>(() => _ = fs.Length);
            }
        }
コード例 #2
0
ファイル: Position.cs プロジェクト: noahfalk/corefx
 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);
     }
 }
コード例 #3
0
ファイル: Position.cs プロジェクト: Vettvangur/DotnetRuntime
 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);
     }
 }
コード例 #4
0
ファイル: Length.cs プロジェクト: ChuangYang/corefx
 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);
     }
 }
コード例 #5
0
ファイル: Length.cs プロジェクト: Vettvangur/DotnetRuntime
        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);
            }
        }
コード例 #6
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));
     }
 }
コード例 #7
0
ファイル: Position.cs プロジェクト: noahfalk/corefx
 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);
     }
 }
コード例 #8
0
ファイル: Position.cs プロジェクト: Vettvangur/DotnetRuntime
 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);
     }
 }
コード例 #9
0
ファイル: Seek.cs プロジェクト: noahfalk/corefx
 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));
     }
 }