public async Task Sends_ticket_to_middleware( [Frozen] FakeZendeskApi zendesk, [Frozen] Middleware.IApi middleware, Watcher sut, [Pending.Escalated] Ticket ticket) { zendesk.Tickets.Add(ticket); await sut.ShareTicket(ticket.Id); var expectedTicket = new { Ticket = new { ticket.Id, ticket.Status, ticket.Description, ticket.Subject, ticket.CreatedAt, } }; await middleware.Received().EscalateTicket( Verify.That <Middleware.EventWrapper>(x => x.Should().BeEquivalentTo(expectedTicket))); }
public async Task Sends_ticket_to_middleware_with_attachments( [Frozen] FakeZendeskApi zendesk, [Frozen] Middleware.IApi middleware, Watcher sut, [Pending.HandedOff] Ticket ticket, Comment[] comments) { // Given zendesk.Tickets.Add(ticket); zendesk.AddComments(ticket, comments); // When await sut.ShareTicket(ticket.Id); // Then var expected = new { Ticket = new { Comments = comments.Select(c => new { c.Id, Attachments = c.Attachments.Select(a => new { Filename = a.FileName, Url = a.ContentUrl, }), }), } }; await middleware.Received().HandOffTicket( Verify.That <Middleware.EventWrapper>( body => body.Should().BeEquivalentTo(expected))); }
public async Task Sends_all_comments( [Frozen] FakeZendeskApi zendesk, [Frozen] Middleware.IApi middleware, Watcher sut, [Pending.HandedOff] Ticket ticket, Comment[] comments) { comments[0].Public = false; comments[1].Public = true; zendesk.Tickets.Add(ticket); zendesk.AddComments(ticket, comments); await sut.ShareTicket(ticket.Id); var expectedTicket = new { Ticket = new { Comments = comments.Select(x => new { x.Id, x.Body, }), } }; await middleware.Received().HandOffTicket( Verify.That <Middleware.EventWrapper>(x => x.Should().BeEquivalentTo(expectedTicket))); }
public async Task Sends_ticket_to_middleware_with_no_comments( [Frozen] FakeZendeskApi zendesk, [Frozen] Middleware.IApi middleware, Watcher sut, [Pending.Solved] Ticket ticket, Comment[] comments) { // Given zendesk.Tickets.Add(ticket); zendesk.AddComments(ticket, comments); // When await sut.ShareTicket(ticket.Id); // Then var mwt = new { Ticket = new { Comments = Array.Empty <Middleware.Model.Comments>(), } }; await middleware.Received().SolveTicket( Verify.That <Middleware.EventWrapper>( body => body.Should().BeEquivalentTo(mwt))); }
public async Task Sends_ticket_to_middleware_with_tagged_comment( [Frozen] FakeZendeskApi zendesk, [Frozen] Middleware.IApi middleware, Watcher sut, [Frozen] AuditedComment comment, [Pending.Escalated] Ticket ticket) { // Given var auditTagEvent = comment.AuditTagEvent.Value = "escalated_tag"; zendesk.Tickets.Add(ticket); // When await sut.ShareTicket(ticket.Id); // Then var mwt = new { Ticket = new { Comments = new[] { new { comment.Id } } } }; await middleware.Received().EscalateTicket( Verify.That <Middleware.EventWrapper>(x => x.Should().BeEquivalentTo(mwt))); }
public async Task Sends_ticket_to_middleware_with_organisation( [Frozen] FakeZendeskApi zendesk, [Frozen] Middleware.IApi middleware, Watcher sut, [Pending.Escalated] Ticket ticket, Organization org) { ticket.OrganizationId = org.Id; zendesk.Tickets.Add(ticket); zendesk.Organizations.Add(org); await sut.ShareTicket(ticket.Id); var mwt = new { Ticket = new { Organization = new { org.Id, org.Name, OrganizationFields = new { org.OrganizationFields.MainPhone, org.OrganizationFields.AddressLine1, org.OrganizationFields.AddressLine2, org.OrganizationFields.AddressLine3, org.OrganizationFields.City, org.OrganizationFields.County, org.OrganizationFields.Postcode, org.OrganizationFields.OrganisationStatus, org.OrganizationFields.OrganisationType, } } } }; await middleware.Received().EscalateTicket(Verify.That <Middleware.EventWrapper>(x => x.Should().BeEquivalentTo(mwt))); }
public async Task Sends_ticket_to_middleware_with_requester( [Frozen] FakeZendeskApi zendesk, [Frozen] Middleware.IApi middleware, Watcher sut, [Pending.Escalated] Ticket ticket, User reporter) { ticket.RequesterId = reporter.Id; zendesk.Tickets.Add(ticket); zendesk.Users.Add(reporter); await sut.ShareTicket(ticket.Id); var mwt = new { Ticket = new { Requester = new { reporter.Id, reporter.Name, reporter.Email, reporter.Phone, UserFields = new { reporter.UserFields.AddressLine1, reporter.UserFields.AddressLine2, reporter.UserFields.AddressLine3, reporter.UserFields.City, reporter.UserFields.County, reporter.UserFields.Postcode, } } } }; await middleware.Received().EscalateTicket(Verify.That <Middleware.EventWrapper>(x => x.Should().BeEquivalentTo(mwt))); }