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

Updates to support date changes in the Holiday API #206

Merged
merged 2 commits into from
Mar 13, 2016
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
9 changes: 5 additions & 4 deletions src/Tests/ScheduleTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using ZendeskApi_v2;
Expand Down Expand Up @@ -94,7 +95,7 @@ public void CanUpdateIntervals()
Assert.True(api.Schedules.DeleteSchedule(res.Schedule.Id.Value));
}

[Test]
[Test]
public void CanCreateUpdateAndDeleteHoliday()
{
var res = api.Schedules.CreateSchedule(new Schedule()
Expand All @@ -106,13 +107,13 @@ public void CanCreateUpdateAndDeleteHoliday()
var res2 = api.Schedules.CreateHoliday(res.Schedule.Id.Value, new Holiday()
{
Name = "Test Holiday",
StartDate = 35,
EndDate = 35
StartDate = DateTimeOffset.Parse("2016-02-05"),
EndDate = DateTimeOffset.Parse("2016-02-05")
});

Assert.Greater(res2.Holiday.Id, 0);

res2.Holiday.EndDate = 36;
res2.Holiday.EndDate = DateTimeOffset.Parse("2016-02-06");
var update = api.Schedules.UpdateHoliday(res.Schedule.Id.Value, res2.Holiday);
Assert.AreEqual(update.Holiday.Name, res2.Holiday.Name);
Assert.AreEqual(update.Holiday.EndDate, res2.Holiday.EndDate);
Expand Down
9 changes: 7 additions & 2 deletions src/ZendeskApi_v2/Models/Schedules/Holiday.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using ZendeskApi_v2.Serialization;

namespace ZendeskApi_v2.Models.Schedules
{
Expand All @@ -11,9 +14,11 @@ public class Holiday
public string Name { get; set; }

[JsonProperty("start_date")]
public int? StartDate { get; set; }
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTimeOffset? StartDate { get; set; }

[JsonProperty("end_date")]
public int? EndDate { get; set; }
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTimeOffset? EndDate { get; set; }
}
}