public void CreateModuleTest() { TicketModule temp = NewModule(); InsertModuleIntoDatabase(temp); //Make sure it returns a row id and that that record exists. Assert.IsTrue(temp.TicketModuleId > 0, "The TicketModule insertion did not return a row id"); Assert.IsTrue(SelectModuleById(temp.TicketModuleId) != null, "The internal selection query used to verify this test failed to return the a row."); }
/// <summary> /// Creates shiny new modules that are not referenced / altered by other methods. /// </summary> /// <returns></returns> private TicketModule NewModule() { //Initialize a basic module object. TicketModule Module = new TicketModule(); Module.Description = "This is my testing description"; Module.Name = "Module Name - Testing"; Module.TicketQueueId = 1; Module.IsActive = true; return(Module); }
public void GetAllModulesTest() { TicketModuleCollection tempModuleCol = new TicketModuleCollection(); //Create a new module, insert it into the database, and then insert it into the Module Collection. for (int x = 0; x < 10; x++) { TicketModule tempMod = NewModule(); InsertModuleIntoDatabase(tempMod); tempModuleCol.Add(tempMod); } //Get all Modules... TicketModuleCollection tempModuleCol2 = HelpdeskService.GetAllModules(); foreach (TicketModule temp in tempModuleCol) { Assert.IsTrue(tempModuleCol2.Contains(temp)); } }
public void EditModuleTest() { TicketModule temp = NewModule(); InsertModuleIntoDatabase(temp); //Make sure the insertion worked smoothly. Assert.IsTrue(temp.Equals(SelectModuleById(temp.TicketModuleId)), "The created module and selected module do not match. Insertion or selection might have failed"); //Change the values... temp.Name = "New Module name!"; temp.Description = "New Module Description"; temp.IsActive = false; temp.TicketQueueId = 3; //Peform the update. HelpdeskService.EditModule(temp); //Create a new instance of the module object and compare them... TicketModule temp2 = SelectModuleById(temp.TicketModuleId); //Make sure they match. Assert.IsTrue(temp.Equals(temp2), "The updated module did not match equality with the prepared module values in the method."); }
/// <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> /// Creates shiny new modules that are not referenced / altered by other methods. /// </summary> /// <returns></returns> private TicketModule NewModule() { //Initialize a basic module object. TicketModule Module = new TicketModule(); Module.Description = "This is my testing description"; Module.Name = "Module Name - Testing"; Module.TicketQueueId = 1; Module.IsActive = true; return Module; }
/// <summary> /// Helper method to insert values into the database. If successful, it will set teh appropriate row id. /// </summary> /// <param name="Module"></param> private void InsertModuleIntoDatabase(TicketModule Module) { HelpdeskService.CreateModule(Module); }
/// <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; }
public static void CreateModule(TicketModule module) { LoadProviders(); _provider.CreateModule(module); }
public static void EditModule(TicketModule module) { LoadProviders(); _provider.EditModule(module); }
public abstract void EditModule(TicketModule module);
public abstract void CreateModule(TicketModule module);