示例#1
0
        public void SaveAndRetrieve()
        {
            var collection = mongoDBFixture.Database
                             .GetCollection <TestDocument>(collectionName);

            List <TestDocument> IEnumerable;

            collection.InsertOne(TestDocument.DummyData1());
            collection.InsertOne(TestDocument.DummyData2());
            collection.InsertOne(TestDocument.DummyData3());

            IEnumerable = (from c in collection.AsQueryable()
                           where c.StringTest == TestDocument.DummyData2().StringTest || c.StringTest == TestDocument.DummyData3().StringTest
                           select c).ToList();

            Assert.Equal(2, IEnumerable.Count());
        }