예제 #1
0
      public async Task ListAsync_WhenCalled_ShouldGetAllCommentsForTicket()
      {
          var ticket = await _ticketResource.CreateAsync(new TicketCreateRequest("description") { Subject = "Test 1" });

          var comments = await _resource.ListAsync(ticket.Ticket.Id);

          Assert.Single(comments);
          Assert.NotNull(comments.ElementAt(0).Id);
          Assert.Equal("description", comments.ElementAt(0).Body);

          await _resource.AddComment(ticket.Ticket.Id, new Models.TicketComment {
                Body = "Hi there! im a comments..."
            });

          comments = await _resource.ListAsync(ticket.Ticket.Id);

          Assert.Equal(2, comments.Count());
          Assert.NotNull(comments.ElementAt(1).Id);
          Assert.Equal("Hi there! im a comments...", comments.ElementAt(1).Body);

          await _resource.AddComment(ticket.Ticket.Id, new Models.TicketComment {
                Body = "Hi there! im a second comment..."
            });

          comments = await _resource.ListAsync(ticket.Ticket.Id);

          Assert.Equal(3, comments.Count());
          Assert.NotNull(comments.ElementAt(1).Id);
          Assert.Equal("Hi there! im a comments...", comments.ElementAt(1).Body);
          Assert.NotNull(comments.ElementAt(2).Id);
          Assert.Equal("Hi there! im a second comment...", comments.ElementAt(2).Body);
      }
        public async Task ShouldCreateTicket()
        {
            var response = await _resource.CreateAsync(
                new TicketCreateRequest("description")
            {
                Subject = "My printer is on fire!",
                Comment = new TicketComment
                {
                    Body = "The smoke is very colorful."
                }
            });

            Assert.NotEqual(0L, response.Ticket.Id);
            Assert.Equal("My printer is on fire!", response.Ticket.Subject);
        }