Пример #1
0
        private void createIdentityMocks()
        {
            // identity
            UserQuery    sampleUserQuery  = mock(typeof(UserQuery));
            GroupQuery   sampleGroupQuery = mock(typeof(GroupQuery));
            IList <User> mockUsers        = new List <User>();
            User         mockUser         = MockProvider.createMockUser();

            mockUsers.Add(mockUser);

            // user query
            when(sampleUserQuery.memberOfGroup(anyString())).thenReturn(sampleUserQuery);
            when(sampleUserQuery.list()).thenReturn(mockUsers);

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

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

            when(mockIdentityService.createGroupQuery()).thenReturn(sampleGroupQuery);
            when(mockIdentityService.createUserQuery()).thenReturn(sampleUserQuery);
        }
Пример #2
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);
        }