public virtual void TestSearch2() { ConnectorFacade search = GetFacade(); for (int i = 0; i < 100; i++) { ICollection <ConnectorAttribute> co = GetTestCreateConnectorObject(string.Format("TEST{0:D5}", i)); co.Add(ConnectorAttributeBuilder.Build("sortKey", i)); search.Create(ObjectClass.ACCOUNT, co, null); } OperationOptionsBuilder builder = new OperationOptionsBuilder { PageSize = 10, SortKeys = new[] { new SortKey("sortKey", false) } }; SearchResult result = null; ICollection <ConnectorObject> resultSet = new HashSet <ConnectorObject>(); int pageIndex = 0; int index = 101; while ((result = search.Search(ObjectClass.ACCOUNT, FilterBuilder.StartsWith(ConnectorAttributeBuilder.Build(Name.NAME, "TEST")), new ResultsHandler() { Handle = connectorObject => { int?idx = ConnectorAttributeUtil.GetIntegerValue(connectorObject.GetAttributeByName("sortKey")); Assert.IsTrue(idx < index); if (idx != null) { index = (int)idx; } resultSet.Add(connectorObject); return(true); } }, builder.Build())).PagedResultsCookie != null) { builder = new OperationOptionsBuilder(builder.Build()) { PagedResultsCookie = result.PagedResultsCookie }; Assert.AreEqual(10 * ++pageIndex, resultSet.Count); } Assert.AreEqual(9, pageIndex); Assert.AreEqual(100, resultSet.Count); }