mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-09 04:56:29 +00:00
Test GitTag deserialization
This commit is contained in:
@@ -43,10 +43,10 @@ public class TagsClientTests
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new TagsClient(connection);
|
||||
|
||||
client.Create("owner", "repo", new NewTag{Type = NewTagType.Tree});
|
||||
client.Create("owner", "repo", new NewTag{Type = TaggedType.Tree});
|
||||
|
||||
connection.Received().Post<GitTag>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/repo/git/tags"),
|
||||
Arg.Is<NewTag>(nt => nt.Type == NewTagType.Tree));
|
||||
Arg.Is<NewTag>(nt => nt.Type == TaggedType.Tree));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -168,6 +168,11 @@ namespace Octokit.Tests.Http
|
||||
Assert.Equal("tag-message", response.BodyAsObject.Message);
|
||||
Assert.Equal("tagger-name", response.BodyAsObject.Tagger.Name);
|
||||
Assert.Equal("tagger-email", response.BodyAsObject.Tagger.Email);
|
||||
//Adjust expected date for time zone adjustment
|
||||
Assert.Equal(new DateTime(2011, 06, 17, 21, 53, 35), response.BodyAsObject.Tagger.Date);
|
||||
Assert.Equal(TaggedType.Commit, response.BodyAsObject.Object.Type);
|
||||
Assert.Equal("object-sha", response.BodyAsObject.Object.Sha);
|
||||
Assert.Equal("object-url", response.BodyAsObject.Object.Url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,17 +10,7 @@ namespace Octokit
|
||||
public string Object { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods",
|
||||
Justification = "Property name as defined by web api")]
|
||||
public NewTagType Type { get; set; }
|
||||
public TaggedType Type { get; set; }
|
||||
public Tagger Tagger { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the type of object being tagged
|
||||
/// </summary>
|
||||
public enum NewTagType
|
||||
{
|
||||
Commit,
|
||||
Blob,
|
||||
Tree
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,21 @@
|
||||
{
|
||||
public class TagObject
|
||||
{
|
||||
public string Name { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods",
|
||||
Justification = "Name defined by web api and required for deserialisation")]
|
||||
public TaggedType Type { get; set; }
|
||||
public string Sha { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the type of object being tagged
|
||||
/// </summary>
|
||||
public enum TaggedType
|
||||
{
|
||||
Commit,
|
||||
Blob,
|
||||
Tree
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user