Пример #1
0
        public void TestCInt64Id()
        {
            _collection.RemoveAll();

            var id       = 123L;
            var document = new CInt64Id {
                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 <CInt64Id>();
            Assert.AreEqual(id, document.Id);
            Assert.AreEqual(2, document.A);
        }
        public void TestCInt64Id() {
            collection.RemoveAll();

            var id = 123L;
            var document = new CInt64Id { 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<CInt64Id>();
            Assert.AreEqual(id, document.Id);
            Assert.AreEqual(2, document.A);
        }