public void CreateCategoryTest() { TicketCategory temp = NewCategory(); HelpdeskService.CreateCategory(temp); Trace.WriteLine(temp.TicketCategoryId); Assert.IsTrue(SelectCategoryById(temp.TicketCategoryId) != null, "The internal selection query used to verify this test failed to return the a row."); Assert.IsTrue(temp.TicketCategoryId > 0, "The returned Id from the CreateQueue test did not return a value greater than 0."); }
/// <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="Category"></param> private void InsertCategoryIntoDatabase(TicketCategory category) { HelpdeskService.CreateCategory(category); }