Files
octokit.net/Octokit.Tests.Integration/Clients/RepositoryCustomPropertiesClientTests.cs
Colby Williams 9a3177e385 [FEAT]: Custom Properties (#2933)
* add custom properties model and clients

* observable

* observable tests

* add search

* error CS8370: 'target-typed object creation'

* Error CS8370: 'target-typed object creation'

* add patch with body that return status code

* fixes for failed ConventionTests

* working UnitTests

* (de)serialization and model tests

* Update Repository.cs
2024-06-17 15:01:20 -07:00

60 lines
1.7 KiB
C#

using System.Threading.Tasks;
using Xunit;
#if SODIUM_CORE_AVAILABLE
using Sodium;
#endif
namespace Octokit.Tests.Integration.Clients
{
/// <summary>
/// Access to view and update custom property values is required for the following tests
/// </summary>
public class RepositoryCustomPropertiesClientTests
{
/// <summary>
/// Fill these in for tests to work
/// </summary>
internal const string OWNER = "octokit";
internal const string REPO = "octokit.net";
public class GetAllMethod
{
[IntegrationTest]
public async Task GetPropertyValues()
{
var github = Helper.GetAuthenticatedClient();
var propertyValues = await github.Repository.CustomProperty.GetAll(OWNER, REPO);
Assert.NotEmpty(propertyValues);
}
}
public class CreateOrUpdateMethod
{
#if SODIUM_CORE_AVAILABLE
[IntegrationTest]
public async Task UpsertPropertyValues()
{
var github = Helper.GetAuthenticatedClient();
var now = DateTime.Now;
var upsertValue = new UpsertRepositoryCustomPropertyValues
{
Properties = new List<CustomPropertyValueUpdate>
{
new CustomPropertyValueUpdate("TEST", "UPSERT_TEST")
}
};
var updatedValues = await github.Repository.CustomProperty.CreateOrUpdate(OWNER, REPO, upsertValue);
Assert.NotNull(updatedValues);
Assert.True(updatedValues.Count > 0);
}
#endif
}
}
}