<commit_before>﻿using Picturepark.SDK.V1.Contract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using System.IO;
using Picturepark.SDK.V1.Tests.Fixtures;

namespace Picturepark.SDK.V1.Tests
{
	public class PermissionTests : IClassFixture<SDKClientFixture>
	{
		private SDKClientFixture _fixture;
		private PictureparkClient _client;

		public PermissionTests(SDKClientFixture fixture)
		{
			_fixture = fixture;
			_client = _fixture.Client;
		}

		[Fact]
		[Trait("Stack", "Permissions")]
		public async Task ShouldGetContentPermissions()
		{
			string permissionSetId = _fixture.GetRandomContentPermissionSetId(20);
			Assert.False(string.IsNullOrEmpty(permissionSetId));

			ContentPermissionSetDetail result = await _client.Permissions.GetContentPermissionsAsync(permissionSetId);
			Assert.False(string.IsNullOrEmpty(result.Id));
		}

		[Fact]
		[Trait("Stack", "Permissions")]
		public async Task ShouldGetSchemaPermissions()
		{
			string permissionSetId = _fixture.GetRandomMetadataPermissionSetId(20);
			Assert.False(string.IsNullOrEmpty(permissionSetId));

			SchemaPermissionSetDetail result = await _client.Permissions.GetSchemaPermissionsAsync(permissionSetId);
			Assert.False(string.IsNullOrEmpty(result.Id));
		}

		[Fact]
		[Trait("Stack", "Permissions")]
		public async Task ShouldSearchContentPermissions()
		{
			var request = new PermissionSetSearchRequest() { Limit = 20 };
			PermissionSetSearchResult result = await _client.Permissions.SearchContentPermissionsAsync(request);

			Assert.True(result.Results.Count() > 0);
		}

		[Fact]
		[Trait("Stack", "Permissions")]
		public async Task ShouldSearchMetadataPermissions()
		{
			var request = new PermissionSetSearchRequest() { Limit = 20 };
			PermissionSetSearchResult result = await _client.Permissions.SearchSchemaPermissionsAsync(request);

			Assert.True(result.Results.Count() > 0);
		}
	}
}<commit_msg>Added ShouldGetUserPermissions test<commit_after>﻿using Picturepark.SDK.V1.Contract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using System.IO;
using Picturepark.SDK.V1.Tests.Fixtures;

namespace Picturepark.SDK.V1.Tests
{
	public class PermissionTests : IClassFixture<SDKClientFixture>
	{
		private SDKClientFixture _fixture;
		private PictureparkClient _client;

		public PermissionTests(SDKClientFixture fixture)
		{
			_fixture = fixture;
			_client = _fixture.Client;
		}

		[Fact]
		[Trait("Stack", "Permissions")]
		public async Task ShouldGetUserPermissions()
		{
			/// Act
			var result = await _client.Permissions.GetUserPermissionsAsync(UserRight.ManageCollections);

			/// Assert
			Assert.True(result);
		}

		[Fact]
		[Trait("Stack", "Permissions")]
		public async Task ShouldGetContentPermissions()
		{
			/// Arrange
			string permissionSetId = _fixture.GetRandomContentPermissionSetId(20);
			Assert.False(string.IsNullOrEmpty(permissionSetId));

			/// Act
			ContentPermissionSetDetail result = await _client.Permissions.GetContentPermissionsAsync(permissionSetId);

			/// Assert
			Assert.False(string.IsNullOrEmpty(result.Id));
		}

		[Fact]
		[Trait("Stack", "Permissions")]
		public async Task ShouldGetSchemaPermissions()
		{
			/// Arrange
			string permissionSetId = _fixture.GetRandomMetadataPermissionSetId(20);
			Assert.False(string.IsNullOrEmpty(permissionSetId));

			/// Act
			SchemaPermissionSetDetail result = await _client.Permissions.GetSchemaPermissionsAsync(permissionSetId);

			/// Assert
			Assert.False(string.IsNullOrEmpty(result.Id));
		}

		[Fact]
		[Trait("Stack", "Permissions")]
		public async Task ShouldSearchContentPermissions()
		{
			/// Arrange
			var request = new PermissionSetSearchRequest() { Limit = 20 };

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

			/// Assert
			Assert.True(result.Results.Count() > 0);
		}

		[Fact]
		[Trait("Stack", "Permissions")]
		public async Task ShouldSearchMetadataPermissions()
		{
			/// Arrange
			var request = new PermissionSetSearchRequest() { Limit = 20 };

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

			/// Assert
			Assert.True(result.Results.Count() > 0);
		}
	}
}
{'fraction_non_alphanumeric': 0.10889956531686112, 'fraction_numerical': 0.005948295584534431, 'mean_word_length': 4.876344086021505, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1452944', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1288, 'n_words': 242}