public async Task Get_WithNullCollectionIdAndCollectionKey_ThrowsException(UserSyncanoClient client) { //given var request = new UserQueryRequest(); request.ProjectId = TestData.ProjectId; try { //when await client.Get(request); throw new Exception("Get should throw an exception."); } catch (Exception e) { //then e.ShouldBeType<ArgumentNullException>(); } }
public async Task Get_WithTextContentFilter_GetsListOfUsers(UserSyncanoClient client) { //given var dataRequest = new DataObjectDefinitionRequest(); dataRequest.ProjectId = TestData.ProjectId; dataRequest.CollectionId = TestData.CollectionId; dataRequest.Text = "sample text content"; await _dataClient.New(dataRequest); var request = new UserQueryRequest(); request.ProjectId = TestData.ProjectId; request.CollectionId = TestData.CollectionId; request.Filter = DataObjectContentFilter.Text; //when var result = await client.Get(request); //then result.ShouldNotBeNull(); result.Count.ShouldEqual(1); //cleanup var deleteRequest = new DataObjectSimpleQueryRequest(); deleteRequest.ProjectId = TestData.ProjectId; deleteRequest.CollectionId = TestData.CollectionId; await _dataClient.Delete(deleteRequest); }
public async Task Get_WithInvalidCollectionId_ThrowsException(UserSyncanoClient client) { //given var request = new UserQueryRequest(); request.ProjectId = TestData.ProjectId; request.CollectionId = "abcde"; try { //when await client.Get(request); throw new Exception("Get should throw an exception."); } catch (Exception e) { //then e.ShouldBeType<SyncanoException>(); } }
public async Task Get_WithFolderListName_GetsListOfUsers(UserSyncanoClient client) { //given var dataRequest = new DataObjectDefinitionRequest(); dataRequest.ProjectId = TestData.ProjectId; dataRequest.CollectionId = TestData.CollectionId; dataRequest.Folder = TestData.FolderName; await _dataClient.New(dataRequest); var request = new UserQueryRequest(); request.ProjectId = TestData.ProjectId; request.CollectionId = TestData.CollectionId; request.Folders = new List<string> {TestData.FolderName}; //when var result = await client.Get(request); //then result.ShouldNotBeNull(); result.Count.ShouldEqual(1); //cleanup var deleteRequest = new DataObjectSimpleQueryRequest(); deleteRequest.ProjectId = TestData.ProjectId; deleteRequest.CollectionId = TestData.CollectionId; await _dataClient.Delete(deleteRequest); }