Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public static async Task <ContentSearchResult> GetRandomContentsAsync(IPictureparkService client, string searchString, int limit, IReadOnlyList <ContentType> contentTypes = null)
        {
            var request = new ContentSearchRequest {
                SearchString = searchString, Limit = limit
            };

            if (contentTypes?.Any() == true)
            {
                request.Filter = new TermsFilter
                {
                    Field = nameof(ContentDetail.ContentType).ToLowerCamelCase(),
                    Terms = contentTypes.Select(ct => ct.ToString()).ToArray()
                };
            }

            return(await client.Content.SearchAsync(request));
        }
Exemplo n.º 3
0
        public static async Task <string> GetRandomFileTransferIdAsync(IPictureparkService client, int limit)
        {
            string fileTransferId             = string.Empty;
            FileTransferSearchRequest request = new FileTransferSearchRequest()
            {
                Limit = limit
            };
            FileTransferSearchResult result = await client.Transfer.SearchFilesAsync(request);

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

            return(fileTransferId);
        }
Exemplo n.º 4
0
        public static async Task <SchemaDetail> CreateSchemasIfNotExistentAsync <T>(IPictureparkService client)
            where T : class
        {
            var childSchemas = await client.Schema.GenerateSchemasAsync(typeof(T)).ConfigureAwait(false);

            var schemasToCreate = new List <SchemaDetail>();

            foreach (var schema in childSchemas)
            {
                if (!await client.Schema.ExistsAsync(schema.Id).ConfigureAwait(false))
                {
                    schemasToCreate.Add(schema);
                }
            }

            await client.Schema.CreateManyAsync(schemasToCreate, true, TimeSpan.FromMinutes(1)).ConfigureAwait(false);

            var schemaId = typeof(T).Name;

            return(await client.Schema.GetAsync(schemaId).ConfigureAwait(false));
        }
Exemplo n.º 5
0
        public static async Task <string> GetRandomContentIdAsync(IPictureparkService client, string searchString, int limit)
        {
            string contentId             = string.Empty;
            ContentSearchRequest request = new ContentSearchRequest {
                Limit = limit
            };

            if (!string.IsNullOrEmpty(searchString))
            {
                request.SearchString = searchString;
            }

            ContentSearchResult result = await client.Content.SearchAsync(request);

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

            return(contentId);
        }
Exemplo n.º 6
0
        public ClientFixture()
        {
#if NET452
            ServicePointManager.SecurityProtocol =
                SecurityProtocolType.Ssl3 |
                SecurityProtocolType.Tls12 |
                SecurityProtocolType.Tls11 |
                SecurityProtocolType.Tls;
#endif

            var assemblyDirectory = Path.GetFullPath(Path.GetDirectoryName(typeof(ClientFixture).GetTypeInfo().Assembly.Location));
            ProjectDirectory = Path.GetFullPath(assemblyDirectory + "/../../../");

            if (!File.Exists(ProjectDirectory + "Configuration.json"))
            {
                ProjectDirectory = Path.GetFullPath(ProjectDirectory + "../");
            }

            if (!File.Exists(ProjectDirectory + "Configuration.json"))
            {
                ProjectDirectory = Path.GetFullPath(Directory.GetCurrentDirectory() + "/../../../");
            }

            if (!File.Exists(ProjectDirectory + "Configuration.json"))
            {
                ProjectDirectory = Path.GetFullPath(Directory.GetCurrentDirectory() + "/../../../../");
            }

            if (!Directory.Exists(TempDirectory))
            {
                Directory.CreateDirectory(TempDirectory);
            }

            var configurationJson = File.ReadAllText(ProjectDirectory + "Configuration.json");
            _configuration = JsonConvert.DeserializeObject <TestConfiguration>(configurationJson);

            _client = GetLocalizedPictureparkService("en");
        }
Exemplo n.º 7
0
        public static async Task <string> GetRandomShareIdAsync(IPictureparkService client, ShareType shareType, int limit)
        {
            var shareId = string.Empty;

            var request = new ShareSearchRequest
            {
                Limit  = limit,
                Filter = new TermFilter {
                    Field = "shareType", Term = shareType.ToString()
                }
            };

            var result = await client.Share.SearchAsync(request);

            var shares = result.Results;

            if (shares.Count > 0)
            {
                var randomNumber = SafeRandomNext(shares.Count);
                shareId = shares.Skip(randomNumber).First().Id;
            }

            return(shareId);
        }
 public ShareTests(ShareFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
 public ProfileTests(ClientFixture fixture)
 {
     _client = fixture.Client;
 }
Exemplo n.º 10
0
 public OutputTests(ClientFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
Exemplo n.º 11
0
 public UserTests(UsersFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
Exemplo n.º 12
0
 public InfoTests(ClientFixture fixture)
 {
     _client = fixture.Client;
 }
Exemplo n.º 13
0
 public SchemaPermissionSetTests(SchemaPermissionSetsFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
Exemplo n.º 14
0
 public ContentPermissionSetTests(ContentPermissionSetsFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
 public AnalyzerTests(ClientFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
Exemplo n.º 16
0
 public BusinessProcessTests(ClientFixture fixture)
 {
     _client = fixture.Client;
 }
Exemplo n.º 17
0
 public ListItemTests(ListItemFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
Exemplo n.º 18
0
 public SchemaTests(SchemaFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
Exemplo n.º 19
0
 public LiveStreamTests(ClientFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
Exemplo n.º 20
0
 public OidcEvents(IPictureparkService pictureparkClient, PictureparkConfiguration cpConfig)
 {
     _pictureparkClient = pictureparkClient;
     _cpConfig          = cpConfig;
 }
Exemplo n.º 21
0
 public DocumentHistoryTests(ClientFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
 public ChannelTests(ClientFixture fixture)
 {
     _client = fixture.Client;
 }
Exemplo n.º 23
0
 public SchemaCreationTests(ClientFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
Exemplo n.º 24
0
 public OutputFormatTests(OutputFormatFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
 public UserRoleTests(ClientFixture fixture)
 {
     _client = fixture.Client;
 }
 public SchemaTransferTests(ClientFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }
 public SchemaInheritanceTests(ClientFixture fixture)
 {
     _fixture = fixture;
     _client  = _fixture.Client;
 }