示例#1
0
		internal AuthTicket(TicketResponse Response)
		{
			Account = Response.Account;
			Ticket = Response.Ticket;
			DefaultCharacter = Response.DefaultCharacter;
			Characters = Response.Characters;
		}
        public void Get_Called_ReturnsTicketResponse()
        {
            // Given
            var response = new TicketResponse { Item = new Ticket { Id = 1 }};
            _client.Setup(b => b.Get<TicketResponse>(It.IsAny<Uri>())).Returns(response);
            var ticketResource = new TicketResource(_client.Object);

            // When
            var result = ticketResource.Get(321);

            // Then
            Assert.That(result, Is.EqualTo(response));
        }
        /// <summary>
        /// Creates shiny new queues that are not referenced / altered by other methods.
        /// </summary>
        /// <returns></returns>
        private TicketResponse NewResponse()
        {
            TicketResponse expected = new TicketResponse();
            expected.CreationDate = TestDate;
            expected.Creator = "nblevins";
            expected.MinsSpent = 33;
            expected.Response = "This is my response...";
            expected.TicketId = 1;

            return expected;
        }
 /// <summary>
 /// Helper method to insert values into the database.  If successful, it will set the appropriate row id.
 /// </summary>
 /// <param name="Category"></param>
 private void InsertResponseIntoDatabase(TicketResponse response)
 {
     HelpdeskService.CreateResponse(response);
 }
 public static void CreateResponse(TicketResponse response)
 {
     LoadProviders(); _provider.CreateResponse(response);
 }
        public void Put_CalledWithTicket_ReturnsTicketReponse()
        {
            // Given
            var response = new TicketResponse { Item = new Ticket { Subject = "blah blah" } };
            var request = new TicketRequest { Item = new Ticket { Subject = "blah blah", Id = 123 } };
            _client.Setup(b => b.Put<TicketResponse>(It.IsAny<Uri>(), request, "application/json")).Returns(response);
            var ticketResource = new TicketResource(_client.Object);

            // When
            var result = ticketResource.Put(request);

            // Then
            Assert.That(result, Is.EqualTo(response));
        }
        public void Delete_Called_CallsDeleteOnClient()
        {
            // Given
            var response = new TicketResponse { Item = new Ticket { Id = 1 } };
            _client.Setup(b => b.Get<TicketResponse>(It.IsAny<Uri>())).Returns(response);
            var ticketResource = new TicketResource(_client.Object);

            // When
            ticketResource.Delete(321);

            // Then
            _client.Verify(c => c.Delete(It.IsAny<Uri>()));
        }
        public void Put_TicketHasNoId_ThrowsException()
        {
            // Given
            var response = new TicketResponse { Item = new Ticket { Subject = "blah blah" } };
            var request = new TicketRequest { Item = new Ticket { Subject = "blah blah" } };
            _client.Setup(b => b.Put<TicketResponse>(It.IsAny<Uri>(), request, "application/json")).Returns(response);
            var ticketResource = new TicketResource(_client.Object);

            // When, Then
            Assert.Throws<ArgumentException>(() => ticketResource.Put(request));
        }
 public abstract void CreateResponse(TicketResponse response);
 public abstract void UpdateResponse(TicketResponse response);