mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
* 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
63 lines
1.7 KiB
C#
63 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using Octokit.Internal;
|
|
using Xunit;
|
|
|
|
namespace Octokit.Tests.Models
|
|
{
|
|
public class CustomPropertyValueUpdateTests
|
|
{
|
|
[Fact]
|
|
public void CanSerializeMultiSelect()
|
|
{
|
|
var expected = "{\"property_name\":\"test_ms\"," +
|
|
"\"value\":[\"option_d\",\"option_e\"]}";
|
|
|
|
|
|
var update = new CustomPropertyValueUpdate("test_ms", new List<string> { "option_d", "option_e" });
|
|
|
|
var json = new SimpleJsonSerializer().Serialize(update);
|
|
|
|
Assert.Equal(expected, json);
|
|
}
|
|
|
|
[Fact]
|
|
public void CanSerializeSingleSelect()
|
|
{
|
|
var expected = "{\"property_name\":\"test_ss\"," +
|
|
"\"value\":\"option_c\"}";
|
|
|
|
var update = new CustomPropertyValueUpdate("test_ss", "option_c");
|
|
|
|
var json = new SimpleJsonSerializer().Serialize(update);
|
|
|
|
Assert.Equal(expected, json);
|
|
}
|
|
|
|
[Fact]
|
|
public void CanSerializeString()
|
|
{
|
|
var expected = "{\"property_name\":\"test_str\"," +
|
|
"\"value\":\"hello\"}";
|
|
|
|
var update = new CustomPropertyValueUpdate("test_str", "hello");
|
|
|
|
var json = new SimpleJsonSerializer().Serialize(update);
|
|
|
|
Assert.Equal(expected, json);
|
|
}
|
|
|
|
[Fact]
|
|
public void CanSerializeTrueFalse()
|
|
{
|
|
var expected = "{\"property_name\":\"test_tf\"," +
|
|
"\"value\":\"true\"}";
|
|
|
|
var update = new CustomPropertyValueUpdate("test_tf", "true");
|
|
|
|
var json = new SimpleJsonSerializer().Serialize(update);
|
|
|
|
Assert.Equal(expected, json);
|
|
}
|
|
}
|
|
}
|