示例#1
0
        public void TestFreeze()
        {
            var settings = new MongoGridFSSettings();

            Assert.IsFalse(settings.IsFrozen);
            settings.Freeze();
            Assert.IsTrue(settings.IsFrozen);
            settings.Freeze(); // test that it's OK to call Freeze more than once
            Assert.IsTrue(settings.IsFrozen);
            Assert.Throws <InvalidOperationException>(() => settings.ChunkSize = 64 * 1024);
            Assert.Throws <InvalidOperationException>(() => settings.Root      = "root");
            Assert.Throws <InvalidOperationException>(() => settings.SafeMode  = SafeMode.True);
        }
示例#2
0
        public void TestFreeze()
        {
            var settings = new MongoGridFSSettings();

            Assert.IsFalse(settings.IsFrozen);
            settings.Freeze();
            Assert.IsTrue(settings.IsFrozen);
            settings.Freeze(); // test that it's OK to call Freeze more than once
            Assert.IsTrue(settings.IsFrozen);
            Assert.Throws <InvalidOperationException>(() => settings.ChunkSize    = 64 * 1024);
            Assert.Throws <InvalidOperationException>(() => settings.Root         = "root");
            Assert.Throws <InvalidOperationException>(() => settings.UpdateMD5    = true);
            Assert.Throws <InvalidOperationException>(() => settings.VerifyMD5    = true);
            Assert.Throws <InvalidOperationException>(() => settings.WriteConcern = WriteConcern.Acknowledged);
        }