MongoDB.GridFS.GridFileInfoTest.TestOpenReadOnly C# (CSharp) Метод

TestOpenReadOnly() приватный Метод

private TestOpenReadOnly ( ) : void
Результат void
        public void TestOpenReadOnly()
        {
            string filename = "gfi-open.txt";
            GridFile gf = new GridFile(db["tests"], "gfopen");
            GridFileStream gfs = gf.Create(filename);
            gfs.Close();

            gfs = gf.OpenRead(filename);
            Assert.IsNotNull(gfs);
            bool thrown = false;
            try{
                gfs.Write(new byte[]{0},0,1);
            }catch(System.NotSupportedException){
                thrown = true;
            }catch(Exception ex){
                Assert.Fail("Wrong exception thrown " + ex.GetType().Name);
            }
            Assert.IsTrue(thrown, "NotSupportedException not thrown");
        }