mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 12:42:32 +00:00
#1107 Make RepositoryRequest properties nullable and add tests
This commit is contained in:
@@ -33,7 +33,7 @@ namespace Octokit
|
||||
return (from property in map
|
||||
let value = property.GetValue(this)
|
||||
let key = property.Key
|
||||
where !String.IsNullOrEmpty(value)
|
||||
where value != null
|
||||
select new { key, value }).ToDictionary(kvp => kvp.key, kvp => kvp.value);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ namespace Octokit
|
||||
Justification = "GitHub API depends on lower case strings")]
|
||||
static Func<PropertyInfo, object, string> GetValueFunc(Type propertyType)
|
||||
{
|
||||
// get underlying type if nullable
|
||||
propertyType = Nullable.GetUnderlyingType(propertyType) ?? propertyType;
|
||||
|
||||
if (typeof(IEnumerable<string>).IsAssignableFrom(propertyType))
|
||||
{
|
||||
return (prop, value) =>
|
||||
|
||||
Reference in New Issue
Block a user