mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 20:13:40 +00:00
270356b5b4
* Implement GetLicenseContents() method for getting repository's license info * Request License Preview API for calls that return Repository object. * Add missing accept headers to observable methods for ObservableRepositoriesClients * fix impacted unit tests
33 lines
864 B
C#
33 lines
864 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Octokit.Internal;
|
|
using Xunit;
|
|
|
|
namespace Octokit.Tests.Models
|
|
{
|
|
public class LicenseMetadataTests
|
|
{
|
|
[Fact]
|
|
public void CanBeDeserializedFromLicenseJson()
|
|
{
|
|
const string json = @"{
|
|
""key"": ""mit"",
|
|
""name"": ""MIT License"",
|
|
""spdx_id"": ""MIT"",
|
|
""url"": ""https://api.github.com/licenses/mit"",
|
|
""featured"": true
|
|
}";
|
|
var serializer = new SimpleJsonSerializer();
|
|
|
|
var license = serializer.Deserialize<LicenseMetadata>(json);
|
|
|
|
Assert.Equal("mit", license.Key);
|
|
Assert.Equal("MIT License", license.Name);
|
|
Assert.Equal("MIT", license.SpdxId);
|
|
Assert.Equal("https://api.github.com/licenses/mit", license.Url);
|
|
Assert.True(license.Featured);
|
|
}
|
|
}
|
|
}
|
|
|