public void TestClassWithBsonArrayId()
        {
            _collection.RemoveAll();

            var doc = new ClassWithBsonArrayId { Id = null, X = 1 };
            _collection.Insert(doc);

            doc = new ClassWithBsonArrayId { Id = new BsonArray(), X = 1 };
            Assert.Throws<MongoWriteConcernException>(() => { _collection.Insert(doc); });

            doc = new ClassWithBsonArrayId { Id = new BsonArray { 1, 2, 3 }, X = 1 };
            Assert.Throws<MongoWriteConcernException>(() => { _collection.Insert(doc); });
        }
示例#2
0
        public void TestClassWithBsonArrayId()
        {
            _collection.RemoveAll();

            var doc = new ClassWithBsonArrayId { Id = null, X = 1 };
            _collection.Insert(doc);

            doc = new ClassWithBsonArrayId { Id = new BsonArray(), X = 1 };
            Assert.Throws<MongoWriteConcernException>(() => { _collection.Insert(doc); });

            doc = new ClassWithBsonArrayId { Id = new BsonArray { 1, 2, 3 }, X = 1 };
            Assert.Throws<MongoWriteConcernException>(() => { _collection.Insert(doc); });
        }