Skip to content

Commit

Permalink
added test case for Issue #254 unable to find issue. (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
mozts2005 authored Dec 2, 2016
1 parent b125a95 commit 54a03f0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
37 changes: 32 additions & 5 deletions src/Tests/TicketTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,13 +1139,40 @@ public void CanCreateTicketWithPrivateComment()
}

[Test]
public void TicketGroupsAndTags()
public async Task ViaChannel_Set_To_API_Isseue_254()
{
var groups = api.Tickets.GetTicket(5098, TicketSideLoadOptionsEnum.Groups).Groups;
var tagCount = api.Tags.GetTags().Tags[0].Count;
// see https://github.com/mozts2005/ZendeskApi_v2/issues/254

Assert.That(groups.Count(), Is.GreaterThan(0));
Assert.That(tagCount, Is.GreaterThan(0));
var ticket = new Ticket()
{
Subject = "my printer is on fire",
Comment = new Comment() { Body = "HELP" },
Priority = TicketPriorities.Urgent
};

ticket.CustomFields = new List<CustomField>()
{
new CustomField()
{
Id = Settings.CustomFieldId,
Value = "testing"
}
};

var resp = await api.Tickets.CreateTicketAsync(ticket);
var newTicket = resp.Ticket;

Assert.That(newTicket.Via.Channel, Is.EqualTo("api"));

var comment = new Comment { Body = "New comment", Public = true };

var resp2 = await api.Tickets.UpdateTicketAsync(newTicket, comment);
var resp3 = await api.Tickets.GetTicketCommentsAsync(newTicket.Id.Value);

Assert.That(resp3.Comments.Any(c => c.Via?.Channel != "api"), Is.False);

// clean up
await api.Tickets.DeleteAsync(newTicket.Id.Value);
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="NUnit" version="3.5.0" targetFramework="net45" />
<package id="NUnit3TestAdapter" version="3.5.1" targetFramework="net45" />
<package id="NUnit3TestAdapter" version="3.6.0" targetFramework="net45" />
</packages>

0 comments on commit 54a03f0

Please sign in to comment.