Skip to content

Commit

Permalink
Merge pull request #7 from JSkimming/null-created_on
Browse files Browse the repository at this point in the history
The value created_on can be null
  • Loading branch information
JSkimming committed Aug 6, 2015
2 parents e320f7a + 23561c1 commit 54f2118
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/CloudFlare.NET/DnsRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public DnsRecord(
int ttl,
bool locked,
IdentifierTag zoneId,
DateTimeOffset createdOn,
DateTimeOffset? createdOn,
DateTimeOffset modifiedOn,
int priority,
string content = null,
Expand Down Expand Up @@ -120,7 +120,7 @@ public DnsRecord(
/// When the record was created.
/// </summary>
[JsonProperty("created_on")]
public DateTimeOffset CreatedOn { get; }
public DateTimeOffset? CreatedOn { get; }

/// <summary>
/// When the record was last modified.
Expand Down
4 changes: 2 additions & 2 deletions src/CloudFlare.NET/Zone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public Zone(
IdentifierTag id,
string name,
int developmentMode,
DateTimeOffset createdOn,
DateTimeOffset? createdOn,
DateTimeOffset modifiedOn,
IReadOnlyList<string> originalNameServers = null,
string originalRegistrar = null,
Expand Down Expand Up @@ -84,7 +84,7 @@ public Zone(
/// When the zone was created.
/// </summary>
[JsonProperty("created_on")]
public DateTimeOffset CreatedOn { get; }
public DateTimeOffset? CreatedOn { get; }

/// <summary>
/// When the zone was last modified.
Expand Down
1 change: 1 addition & 0 deletions src/Tests/CloudFlare.NET.Tests/CloudFlare.NET.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<Compile Include="EqualsBehaviors.cs" />
<Compile Include="FixtureContext.cs" />
<Compile Include="IdentifierTagSpec.cs" />
<Compile Include="IsNullable.cs" />
<Compile Include="LikenessExtensions.cs" />
<Compile Include="RequiresArgNullEx.cs" />
<Compile Include="RequiresArgNullExAutoMoqAttribute.cs" />
Expand Down
37 changes: 37 additions & 0 deletions src/Tests/CloudFlare.NET.Tests/IsNullable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace CloudFlare.NET
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using AutoTest.ArgNullEx.Filter;

/// <summary>
/// Filters out parameters that are <see cref="Nullable"/> value types.
/// </summary>
public sealed class IsNullable : FilterBase, IParameterFilter
{
/// <summary>
/// Filters out parameters that are <see cref="Nullable"/> value types.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="method">The method.</param>
/// <param name="parameter">The parameter.</param>
/// <returns><see langword="true"/> if the <paramref name="parameter"/> should be excluded;
/// otherwise <see langword="false"/>.</returns>
/// <exception cref="ArgumentNullException">The <paramref name="type"/>, <paramref name="method"/> or
/// <paramref name="parameter"/> parameters are <see langword="null"/>.</exception>
bool IParameterFilter.ExcludeParameter(Type type, MethodBase method, ParameterInfo parameter)
{
if (type == null)
throw new ArgumentNullException(nameof(type));
if (method == null)
throw new ArgumentNullException(nameof(method));
if (parameter == null)
throw new ArgumentNullException(nameof(parameter));

return parameter.ParameterType.IsGenericType &&
parameter.ParameterType.GetGenericTypeDefinition() == typeof(Nullable<>);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "9a7806061c88ada191ed06f989cc3dac",
"name": "example.com",
"zone_id": "9a7806061c88ada191ed06f989cc3dac"
"zone_id": "9a7806061c88ada191ed06f989cc3dac",
"created_on": null
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"id": "9a7806061c88ada191ed06f989cc3dac",
"name": "example.com"
"name": "example.com",
"created_on": null
}

0 comments on commit 54f2118

Please sign in to comment.