Skip to content

Commit 368dffd

Browse files
authored
Adding test case for FollowUpIds
The test logic: 1. creating a ticket and closing it (so we can later create a followUp ticket for it). 2. creating the followUp ticket, by setting the ViaFollowUpSourceId to the original closed ticket id. 3. Making sure that we can get the FollowUpIds of the original ticket.
1 parent b98210d commit 368dffd

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/ZendeskApi_v2.Test/TicketTestPart2.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,37 @@ public async Task CustomDropDownFieldSaveAsync()
136136

137137
Assert.True(api.Tickets.Delete(newTicket.Id.Value));
138138
}
139+
140+
[Test]
141+
public async Task CanGetFollowUpIds()
142+
{
143+
var ticket = new Ticket { Comment = new Comment { Body = "Original ticket", Public = false } };
144+
145+
var resp1 = await api.Tickets.CreateTicketAsync(ticket);
146+
147+
var closedTicket = resp1.Ticket;
148+
149+
closedTicket.Status = TicketStatus.Closed;
150+
151+
await api.Tickets.UpdateTicketAsync(closedTicket, new Comment { Body = "Closing Original Ticket" });
152+
153+
var ticket_Followup = new Ticket()
154+
{
155+
Subject = "I am the follow up Ticket",
156+
Comment = new Comment { Body = "I will be linked to the closed ticket" },
157+
Priority = TicketPriorities.Low,
158+
ViaFollowupSourceId = closedTicket.Id.Value
159+
};
160+
161+
var resp3 = await api.Tickets.CreateTicketAsync(ticket_Followup);
162+
var resp4 = api.Tickets.GetTicket(closedTicket.Id.Value);
163+
164+
Assert.That(resp3.Ticket.Via.Source.Rel, Is.EqualTo("follow_up"));
165+
Assert.AreEqual(resp4.Ticket.FollowUpIds.Count, 1);
166+
Assert.AreEqual(resp4.Ticket.FollowUpIds.ElementAt(0), resp3.Ticket.Id);
167+
168+
Assert.That(await api.Tickets.DeleteAsync(resp3.Ticket.Id.Value), Is.True);
169+
Assert.That(await api.Tickets.DeleteAsync(closedTicket.Id.Value), Is.True);
170+
}
139171
}
140172
}

0 commit comments

Comments
 (0)