#1107 Make RepositoryRequest properties nullable and add tests

This commit is contained in:
Alex P
2016-03-08 15:57:55 +02:00
parent 0188238cb5
commit f50ccf77b1
4 changed files with 60 additions and 18 deletions
+4 -1
View File
@@ -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) =>