public void CreateTicketTest_BasicData() { Ticket temp = NewTicket(); HelpdeskService.CreateTicket(temp); Trace.WriteLine(temp.TicketId); Assert.IsTrue(SelectTicketById(temp.TicketId) != null, "The internal selection query used to verify this test failed to return the a row."); Assert.IsTrue(temp.TicketId > 0, "The returned Id from the CreateTicket test did not return a value greater than 0."); }
public void GetAllTicketsByQueueIdTest() { TicketCollection CreatedSet = new TicketCollection(); //Select everything in the database. TicketCollection PreSelectionSet = HelpdeskService.GetTicketsByQueueId(1, true); //Add the new items into the database and keep of collection of them for deletion later... for (int x = 0; x < 10; x++) { Ticket temp = NewTicket(); temp.Queue.QueueId = 1; HelpdeskService.CreateTicket(temp); CreatedSet.Add(temp); } //Get teh values of everything in teh datbase now that we have done some insertions. TicketCollection PostSelectionSet = HelpdeskService.GetTicketsByQueueId(1, true); //Check their counts to make sure everything went into the database correctly. Assert.IsTrue((PreSelectionSet.Count + 10) >= PostSelectionSet.Count); }
/// <summary> /// Helper method to insert values into the database. If successful, it will set the appropriate row id. /// </summary> /// <param name="Module"></param> private void InsertTicketIntoDatabase(Ticket ticket) { HelpdeskService.CreateTicket(ticket); }