private TenantQuery setUpMockQuery(IList <Tenant> tenants) { TenantQuery query = mock(typeof(TenantQuery)); when(query.list()).thenReturn(tenants); when(query.count()).thenReturn((long)tenants.Count); when(processEngine.IdentityService.createTenantQuery()).thenReturn(query); return(query); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void queryById() public virtual void queryById() { TenantQuery query = identityService.createTenantQuery().tenantId(TENANT_ONE); assertThat(query.count(), @is(1L)); assertThat(query.list().size(), @is(1)); Tenant tenant = query.singleResult(); assertThat(tenant, @is(notNullValue())); assertThat(tenant.Name, @is("Tenant_1")); }
protected internal virtual IList <string> setupTenantQueryMock(IList <Tenant> tenants) { TenantQuery mockTenantQuery = mock(typeof(TenantQuery)); when(identityServiceMock.createTenantQuery()).thenReturn(mockTenantQuery); when(mockTenantQuery.userMember(anyString())).thenReturn(mockTenantQuery); when(mockTenantQuery.includingGroupsOfUser(anyBoolean())).thenReturn(mockTenantQuery); when(mockTenantQuery.list()).thenReturn(tenants); IList <string> tenantIds = new List <string>(); foreach (Tenant tenant in tenants) { tenantIds.Add(tenant.Id); } return(tenantIds); }
public virtual IList <TenantDto> queryTenants(UriInfo uriInfo, int?firstResult, int?maxResults) { TenantQueryDto queryDto = new TenantQueryDto(ObjectMapper, uriInfo.QueryParameters); TenantQuery query = queryDto.toQuery(ProcessEngine); IList <Tenant> tenants; if (firstResult != null || maxResults != null) { tenants = executePaginatedQuery(query, firstResult, maxResults); } else { tenants = query.list(); } return(TenantDto.fromTenantList(tenants)); }