public void CreateQueueTest() { TicketQueue temp = NewQueue(); HelpdeskService.CreateQueue(temp); Trace.WriteLine(temp.QueueId); Assert.IsTrue(SelectQueueById(temp.QueueId) != null, "The internal selection query used to verify this test failed to return the a row."); Assert.IsTrue(temp.QueueId > 0, "The returned Id from the CreateQueue test did not return a value greater than 0."); }
public void GetAllEnabledQueuesTest() { TicketQueueCollection CreatedSet = new TicketQueueCollection(); //Select everything in teh database. TicketQueueCollection PreSelectionSet = HelpdeskService.GetAllEnabledQueues(); //Add the new items into the database and keep of collection of them for deletion later... for (int x = 0; x < 10; x++) { TicketQueue temp = NewQueue(); HelpdeskService.CreateQueue(temp); CreatedSet.Add(temp); } //Get teh values of everything in teh datbase now that we have done some insertions. TicketQueueCollection PostSelectionSet = HelpdeskService.GetAllEnabledQueues(); //Check their counts to make sure everything went into the database correctly. Assert.IsTrue((PreSelectionSet.Count + 10) == PostSelectionSet.Count); }
/// <summary> /// Creates shiny new queues that are not referenced / altered by other methods. /// </summary> /// <returns></returns> private Ticket NewTicket() { //Make the complex objects and retunr their ID. TicketQueue que = new TicketQueue(0, "nblevins", "description", "QueueName", TestDate, true); HelpdeskService.CreateQueue(que); TicketCategory cat = new TicketCategory(0, "Category Name", "Category Description", true, que.QueueId); HelpdeskService.CreateCategory(cat); TicketModule mod = new TicketModule(0, que.QueueId, "Module Name", "Description", true); HelpdeskService.CreateModule(mod); Requestor req = new Requestor(0, "nbleivns", "Blevins", "444-444-4444", "*****@*****.**"); HelpdeskService.CreateRequestor(req); TicketStatus stat = new TicketStatus(0, "Status Name", "Description", 1, true); HelpdeskService.CreateStatus(stat); //Set up the ticket... Ticket temp = new Ticket(); temp.Category = cat; temp.CreationDate = TestDate; temp.Creator = "nblevins"; temp.Description = "This is my ticket decription."; temp.DueDate = TestDate + new TimeSpan(2, 0, 0); temp.Module = mod; temp.Priority = TicketPriority.Medium; temp.Requestor = req; temp.Responses = new TicketResponseCollection(); temp.Status = stat; temp.Assignment = new AssignmentCollection(); temp.Queue = que; //Build the company... Company comp = new Company(); comp.Address1 = "addy1"; comp.Address2 = "addy2"; comp.City = "some city"; comp.ContactNumber1 = "444-444-4444"; comp.ContactNumber2 = "322-333-3333"; comp.Name = "New Company"; comp.ParentId = 0; comp.State = "TN"; comp.Website = "www.sworps.com"; comp.Zip_Code = "33333-3333"; Requestor MainReq = new Requestor(); MainReq.ContactNumber = "555-555-5555"; MainReq.Email = "*****@*****.**"; MainReq.FirstName = "nathan 1"; MainReq.LastName = "bleivns 1"; HelpdeskService.CreateRequestor(MainReq); comp.MainContact = MainReq; Requestor SecReq = new Requestor(); SecReq.ContactNumber = "555-222-5555"; SecReq.Email = "*****@*****.**"; SecReq.FirstName = "nathan 2"; SecReq.LastName = "bleivns 2"; HelpdeskService.CreateRequestor(SecReq); comp.SecondaryContact = SecReq; temp.Company = comp; return(temp); }
/// <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 InsertQueueIntoDatabase(TicketQueue queue) { HelpdeskService.CreateQueue(queue); }