Example #1
0
        public async Task Should_search_schema_permission_sets()
        {
            // Arrange
            var request = new PermissionSetSearchRequest {
                Limit = 20
            };

            // Act
            var result = await _client.ContentPermissionSet.SearchAsync(request).ConfigureAwait(false);

            // Assert
            result.Results.Should().NotBeEmpty();
        }
        public async Task ShouldSearchSchemaPermissionSets()
        {
            /// Arrange
            var request = new PermissionSetSearchRequest {
                Limit = 20
            };

            /// Act
            PermissionSetSearchResult result = await _client.Permissions.SearchSchemaPermissionSetsAsync(request);

            /// Assert
            Assert.True(result.Results.Count > 0);
        }
        public static async Task <string> GetRandomContentPermissionSetIdAsync(PictureparkClient client, int limit)
        {
            string permissionSetId             = string.Empty;
            PermissionSetSearchRequest request = new PermissionSetSearchRequest {
                Limit = limit
            };
            PermissionSetSearchResult result = await client.Permissions.SearchContentPermissionSetsAsync(request);

            if (result.Results.Count > 0)
            {
                var randomNumber = new Random().Next(0, result.Results.Count);
                permissionSetId = result.Results.Skip(randomNumber).First().Id;
            }

            return(permissionSetId);
        }
Example #4
0
        public static async Task <string> GetRandomSchemaPermissionSetIdAsync(IPictureparkService client, int limit)
        {
            string permissionSetId = string.Empty;
            var    request         = new PermissionSetSearchRequest {
                Limit = limit
            };
            PermissionSetSearchResult result = await client.SchemaPermissionSet.SearchAsync(request).ConfigureAwait(false);

            if (result.Results.Count > 0)
            {
                int randomNumber = SafeRandomNext(result.Results.Count);
                permissionSetId = result.Results.Skip(randomNumber).First().Id;
            }

            return(permissionSetId);
        }