예제 #1
0
        public void TestCInt32Id()
        {
            _collection.RemoveAll();

            var id       = 123;
            var document = new CInt32Id {
                Id = id, A = 1
            };

            _collection.Save(document);
            Assert.AreEqual(id, document.Id);
            Assert.AreEqual(1, _collection.Count());

            document.A = 2;
            _collection.Save(document);
            Assert.AreEqual(id, document.Id);
            Assert.AreEqual(1, _collection.Count());

            document = _collection.FindOneAs <CInt32Id>();
            Assert.AreEqual(id, document.Id);
            Assert.AreEqual(2, document.A);
        }
        public void TestCInt32Id() {
            collection.RemoveAll();

            var id = 123;
            var document = new CInt32Id { Id = id, A = 1 };
            collection.Save(document);
            Assert.AreEqual(id, document.Id);
            Assert.AreEqual(1, collection.Count());

            document.A = 2;
            collection.Save(document);
            Assert.AreEqual(id, document.Id);
            Assert.AreEqual(1, collection.Count());

            document = collection.FindOneAs<CInt32Id>();
            Assert.AreEqual(id, document.Id);
            Assert.AreEqual(2, document.A);
        }