Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The value created_on can be null #7

Merged
merged 1 commit into from
Aug 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}