mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 03:55:55 +00:00
Add support for deserializing non-public members
But only ones with ParameterAttribute applied.
This commit is contained in:
@@ -96,15 +96,21 @@ namespace Octokit.Tests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnencodesBase64Strings()
|
||||
public void DeserializesProtectedProperties()
|
||||
{
|
||||
const string json = "{\"name\":\"RmVycmlzIEJ1ZWxsZXI=\",\"description\":\"stuff\",\"content\":\"RGF5IG9mZg==\"}";
|
||||
|
||||
var someObject = new SimpleJsonSerializer().Deserialize<SomeObject>(json);
|
||||
const string json = "{\"content\":\"hello\"}";
|
||||
|
||||
Assert.Equal("Ferris Bueller", someObject.Name);
|
||||
Assert.Equal("Day off", someObject.Content);
|
||||
Assert.Equal("stuff", someObject.Description);
|
||||
var someObject = new SimpleJsonSerializer().Deserialize<AnotherObject>(json);
|
||||
|
||||
Assert.Equal("*hello*", someObject.Content);
|
||||
}
|
||||
|
||||
public class AnotherObject
|
||||
{
|
||||
[Parameter(Key = "content")]
|
||||
protected string EncodedContent { get; set; }
|
||||
|
||||
public string Content { get { return "*" + EncodedContent + "*"; } }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user