mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 11:40:42 +00:00
Ensure NewTag serializes correctly
This commit is contained in:
@@ -63,6 +63,31 @@ namespace Octokit.Tests
|
||||
|
||||
Assert.Equal("{\"int\":42,\"bool\":true}", json);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void PerformsNewTagSerialization()
|
||||
{
|
||||
var tag = new NewTag()
|
||||
{
|
||||
Message = "tag-message",
|
||||
Tag = "tag-name",
|
||||
Object = "tag-object",
|
||||
Type = TaggedType.Tree,
|
||||
Tagger = new Tagger
|
||||
{
|
||||
Name = "tagger-name",
|
||||
Email = "tagger-email",
|
||||
Date = new DateTime(2013, 09, 03, 14, 42, 52, DateTimeKind.Local)
|
||||
}
|
||||
};
|
||||
|
||||
var json = new SimpleJsonSerializer().Serialize(tag);
|
||||
|
||||
const string expectedResult = @"{""tag"":""tag-name"",""message"":""tag-message"",""object"":""tag-object"",""type"":""tree"",""tagger"":{""name"":""tagger-name"",""email"":""tagger-email"",""date"":""2013-09-03T13:42:52Z""}}";
|
||||
|
||||
Assert.Equal(expectedResult, json);
|
||||
}
|
||||
}
|
||||
|
||||
public class TheDeserializeMethod
|
||||
|
||||
@@ -4,8 +4,7 @@ namespace Octokit
|
||||
{
|
||||
public class NewTag
|
||||
{
|
||||
[DataMember(Name = "tag")]
|
||||
public string Name { get; set; }
|
||||
public string Tag { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string Object { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods",
|
||||
|
||||
Reference in New Issue
Block a user