MongoDB.DriverUnitTests.MongoCollectionTests.TestSortAndLimit C# (CSharp) Метод

TestSortAndLimit() приватный Метод

private TestSortAndLimit ( ) : void
Результат void
        public void TestSortAndLimit()
        {
            _collection.RemoveAll();
            _collection.Insert(new BsonDocument { { "x", 4 }, { "y", 2 } });
            _collection.Insert(new BsonDocument { { "x", 2 }, { "y", 2 } });
            _collection.Insert(new BsonDocument { { "x", 3 }, { "y", 2 } });
            _collection.Insert(new BsonDocument { { "x", 1 }, { "y", 2 } });
            var result = _collection.FindAll().SetSortOrder("x").SetLimit(3).Select(x => x["x"].AsInt32);
            Assert.AreEqual(3, result.Count());
            CollectionAssert.AreEqual(new[] { 1, 2, 3 }, result);
        }