Exemple #1
0
        private void createMockIdentityQueries()
        {
            UserQuery sampleUserQuery = mock(typeof(UserQuery));

            IList <User> mockUsers = new List <User>();

            mockUser = MockProvider.createMockUser();
            mockUsers.Add(mockUser);

            when(sampleUserQuery.list()).thenReturn(mockUsers);
            when(sampleUserQuery.memberOfGroup(anyString())).thenReturn(sampleUserQuery);
            when(sampleUserQuery.count()).thenReturn((long)mockUsers.Count);

            GroupQuery sampleGroupQuery = mock(typeof(GroupQuery));

            IList <Group> mockGroups = MockProvider.createMockGroups();

            when(sampleGroupQuery.list()).thenReturn(mockGroups);
            when(sampleGroupQuery.groupMember(anyString())).thenReturn(sampleGroupQuery);
            when(sampleGroupQuery.orderByGroupName()).thenReturn(sampleGroupQuery);
            when(sampleGroupQuery.orderByGroupId()).thenReturn(sampleGroupQuery);
            when(sampleGroupQuery.orderByGroupType()).thenReturn(sampleGroupQuery);
            when(sampleGroupQuery.asc()).thenReturn(sampleGroupQuery);
            when(sampleGroupQuery.desc()).thenReturn(sampleGroupQuery);

            when(processEngine.IdentityService.createGroupQuery()).thenReturn(sampleGroupQuery);
            when(processEngine.IdentityService.createUserQuery()).thenReturn(sampleUserQuery);
        }