public void UpdateQueueTest()
        {
            TicketQueue temp = NewQueue();

            InsertQueueIntoDatabase(temp);

            //Make sure the insertion worked smoothly.
            Assert.IsTrue(temp.Equals(SelectQueueById(temp.QueueId)), "The created queue and selected queue do not match.  Insertion or selection might have failed");

            //Change the values...
            temp.Name         = "Testing Queue2";
            temp.Description  = "New Description";
            temp.IsActive     = false;
            temp.Creator      = "blevinsn";
            temp.CreationDate = DateTime.Now;

            //Peform the update.
            HelpdeskService.UpdateQueue(temp);

            //Create a new instance of the module object and compare them...
            TicketQueue temp2 = SelectQueueById(temp.QueueId);

            //Make sure they match.
            Assert.IsTrue(temp.Equals(temp2), "The updated queue did not match equality with the prepared module values in the method.");
        }
        public void SortOnMiddleRequestedOrder()
        {
            //Add a few status's to the database...
            TicketStatusCollection tempCol = new TicketStatusCollection();

            for (int x = 0; x < 10; x++)
            {
                TicketStatus tempStatus = NewStatus();
                InsertStatusIntoDatabase(tempStatus);
                tempCol.Add(tempStatus);
            }

            //Set up our test status.
            TicketStatus temp = NewStatus();

            temp.StatusOrder = 1;
            HelpdeskService.CreateStatus(temp);

            //Fetch all of the status'
            TicketStatusCollection tempCol2 = HelpdeskService.GetAllStatus();

            int MiddleStatusOrder = tempCol2.Count / 2;

            temp.StatusOrder = MiddleStatusOrder;

            HelpdeskService.EditStatus(temp);

            Assert.IsTrue(MiddleStatusOrder == temp.StatusOrder);
        }
Esempio n. 3
0
        public void UpdateTicketTest()
        {
            Ticket temp = NewTicket();

            InsertTicketIntoDatabase(temp);

            int TicketId = temp.TicketId;

            //Make sure the insertion worked smoothly.
            Assert.IsTrue(temp.Equals(SelectTicketById(TicketId)), "The created ticket and selected status do not match.  Insertion or selection might have failed");

            Ticket ChangedTicket = NewTicket();

            //Change the values...
            ChangedTicket.CreationDate = DateTime.Now;
            ChangedTicket.Creator      = "new creator";
            ChangedTicket.DueDate      = DateTime.Now;
            ChangedTicket.Priority     = TicketPriority.High;

            temp          = ChangedTicket;
            temp.TicketId = TicketId;

            //Peform the update.
            HelpdeskService.UpdateTicket(temp);

            //Create a new instance of the module object and compare them...
            Ticket temp2 = SelectTicketById(TicketId);

            //Make sure they match.
            Assert.IsTrue(temp.Equals(temp2), "The updated status did not match equality with the prepared module values in the method.");
        }
        public void UpdateAssignmentTest()
        {
            Assignment temp = NewAssignment();

            InsertAssignmentIntoDatabase(temp);

            //Make sure the insertion worked smoothly.
            Assert.IsTrue(temp.Equals(SelectAssignmentById(temp.AssignmentId)), "The created assignment and selected assignment do not match.  Insertion or selection might have failed");

            //Change the values...
            temp.AssignedTo     = "nblevins(assigned";
            temp.AssignmentDate = TestDate;
            temp.IsActive       = false;
            temp.TicketId       = 1;
            temp.Creator        = "blevinsn";

            //Peform the update.
            HelpdeskService.EditAssignment(temp);

            //Create a new instance of the module object and compare them...
            Assignment temp2 = SelectAssignmentById(temp.AssignmentId);

            //Make sure they match.
            Assert.IsTrue(temp.Equals(temp2), "The updated queue did not match equality with the prepared module values in the method.");
        }
Esempio n. 5
0
        public void EditCompanyTest()
        {
            Company temp = NewCompany();

            InsertCompanyIntoDatabase(temp);

            //Make sure the insertion worked smoothly.
            Assert.IsTrue(temp.Equals(SelectCompanyById(temp.CompanyId)), "The created Category and selected Category do not match.  Insertion or selection might have failed");

            //Change the values...
            temp.Address1       = "--- ---- ----";
            temp.Address2       = "Addy 2 again!";
            temp.City           = "newer city";
            temp.ContactNumber1 = "11";
            temp.ContactNumber2 = "11";
            temp.Name           = "newer company name";
            temp.ParentId       = 0;
            temp.State          = "AK";
            temp.Website        = "www.google.com";
            temp.Zip_Code       = "55555";

            //Peform the update.
            HelpdeskService.UpdateCompany(temp);

            //Create a new instance of the Category object and compare them...
            Company temp2 = SelectCompanyById(temp.CompanyId);

            //Make sure they match.
            Assert.IsTrue(temp.Equals(temp2), "The updated Category did not match equality with the prepared Category values in the method.");
        }
        public void EditResponseTest()
        {
            TicketResponse temp = NewResponse();

            InsertResponseIntoDatabase(temp);

            //Make sure the insertion worked smoothly.
            Assert.IsTrue(temp.Equals(SelectResponseById(temp.TicketResponseId)), "The created Category and selected Category do not match.  Insertion or selection might have failed");

            //Change the values...
            temp.CreationDate = DateTime.Now;
            temp.Creator      = "me me me!";
            temp.MinsSpent    = 22032;
            temp.Response     = "new Response";
            temp.TicketId     = 33;

            //Peform the update.
            HelpdeskService.UpdateResponse(temp);

            //Create a new instance of the Category object and compare them...
            TicketResponse temp2 = SelectResponseById(temp.TicketResponseId);

            //Make sure they match.
            Assert.IsTrue(temp.Equals(temp2), "The updated Category did not match equality with the prepared Category values in the method.");
        }
        public void CreateResponseTest()
        {
            TicketResponse temp = NewResponse();

            HelpdeskService.CreateResponse(temp);

            Assert.IsTrue(SelectResponseById(temp.TicketResponseId) != null, "The internal selection query used to verify this test failed to return the a row.");
            Assert.IsTrue(temp.TicketResponseId > 0, "The returned Id from the CreateQueue test did not return a value greater than 0.");
        }
Esempio n. 8
0
        public void CreateRequestorTest()
        {
            Requestor temp = NewRequestor();

            HelpdeskService.CreateRequestor(temp);

            Trace.WriteLine(temp.RequestorId);

            Assert.IsTrue(SelectRequestorById(temp.RequestorId) != null, "The internal selection query used to verify this test failed to return the a row.");
            Assert.IsTrue(temp.RequestorId > 0, "The returned Id from the CreateQueue test did not return a value greater than 0.");
        }
        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.");
        }
Esempio n. 10
0
        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.");
        }
Esempio n. 11
0
        public void DeleteTicketTest()
        {
            Ticket temp = NewTicket();

            InsertTicketIntoDatabase(temp);

            //Make sure the insert and select are working.
            Assert.IsTrue(SelectTicketById(temp.TicketId) != null, "The select query failed to return any results.");

            HelpdeskService.DeleteTicket(temp.TicketId);

            Assert.IsTrue(SelectTicketById(temp.TicketId) == null, "The selection returned a row, meaning that the delete statmen failed.");
        }
        public void SortOnTooLargeRequestedOrder()
        {
            TicketStatusCollection tempCol = HelpdeskService.GetAllStatus();

            int TooLargeStatusOrder = tempCol.Count + 15;
            int ExpectedStatusOrder = tempCol.Count + 1;

            TicketStatus temp = NewStatus();

            temp.StatusOrder = TooLargeStatusOrder;

            HelpdeskService.CreateStatus(temp);

            Trace.WriteLine(temp.StatusOrder);
            Assert.IsTrue(ExpectedStatusOrder == temp.StatusOrder);
        }
Esempio n. 13
0
        public void GetAllRequestorTest()
        {
            RequestorCollection tempCol = new RequestorCollection();

            //Create a new Category, insert it into the database, and then insert it into the Category Collection.
            for (int x = 0; x < 10; x++)
            {
                Requestor temp = NewRequestor();
                InsertRequestorIntoDatabase(temp);
                tempCol.Add(temp);
            }

            //Get all Categorys...
            RequestorCollection tempCol2 = HelpdeskService.GetAllRequestor();

            foreach (Requestor temp in tempCol)
            {
                Assert.IsTrue(tempCol2.Contains(temp));
            }
        }
        public void GetAllCategoryTest()
        {
            TicketCategoryCollection tempCategoryCol = new TicketCategoryCollection();

            //Create a new Category, insert it into the database, and then insert it into the Category Collection.
            for (int x = 0; x < 10; x++)
            {
                TicketCategory temp = NewCategory();
                InsertCategoryIntoDatabase(temp);
                tempCategoryCol.Add(temp);
            }

            //Get all Categorys...
            TicketCategoryCollection tempCategoryCol2 = HelpdeskService.GetAllCategory();

            foreach (TicketCategory temp in tempCategoryCol)
            {
                Assert.IsTrue(tempCategoryCol2.Contains(temp));
            }
        }
        public void GetAllStatusTest()
        {
            TicketStatusCollection tempCol = new TicketStatusCollection();

            //Create a new module, insert it into the database, and then insert it into the Module Collection.
            for (int x = 0; x < 10; x++)
            {
                TicketStatus tempStatus = NewStatus();
                InsertStatusIntoDatabase(tempStatus);
                tempCol.Add(tempStatus);
            }

            //Get all Modules...
            TicketStatusCollection tempCol2 = HelpdeskService.GetAllStatus();

            foreach (TicketStatus temp in tempCol)
            {
                Assert.IsTrue(tempCol2.Contains(temp), "The inserted collection and the retrived collection did not match in number or type.");
            }
        }
Esempio n. 16
0
        public void GetAllChargeCodeTest()
        {
            TicketChargeCodeCollection tempChargeCodeCol = new TicketChargeCodeCollection();

            //Create a new ChargeCode, insert it into the database, and then insert it into the ChargeCode Collection.
            for (int x = 0; x < 10; x++)
            {
                TicketChargeCode tempCC = NewChargeCode();
                InsertChargeCodeIntoDatabase(tempCC);
                tempChargeCodeCol.Add(tempCC);
            }

            //Get all ChargeCodes...
            TicketChargeCodeCollection tempChargeCodeCol2 = HelpdeskService.GetAllChargeCode();

            foreach (TicketChargeCode temp in tempChargeCodeCol)
            {
                Assert.IsTrue(tempChargeCodeCol2.Contains(temp));
            }
        }
        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));
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Creates shiny new queues that are not referenced / altered by other methods.
        /// </summary>
        /// <returns></returns>
        private Company NewCompany()
        {
            Company expected = new Company();

            expected.Address1       = "addy1";
            expected.Address2       = "addy2";
            expected.City           = "some city";
            expected.ContactNumber1 = "444-444-4444";
            expected.ContactNumber2 = "322-333-3333";
            expected.Name           = "New Company";
            expected.ParentId       = 0;
            expected.State          = "TN";
            expected.Website        = "www.sworps.com";
            expected.Zip_Code       = "33333-3333";

            //Complex objects...

            Requestor MainReq = new Requestor();

            MainReq.ContactNumber = "555-555-5555";
            MainReq.Email         = "*****@*****.**";
            MainReq.FirstName     = "nathan 1";
            MainReq.LastName      = "bleivns 1";
            HelpdeskService.CreateRequestor(MainReq);

            expected.MainContact = MainReq;

            Requestor SecReq = new Requestor();

            SecReq.ContactNumber = "555-222-5555";
            SecReq.Email         = "*****@*****.**";
            SecReq.FirstName     = "nathan 2";
            SecReq.LastName      = "bleivns 2";
            HelpdeskService.CreateRequestor(SecReq);

            expected.SecondaryContact = SecReq;


            return(expected);
        }
        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);
        }
Esempio n. 20
0
        public void GetAssignmentsByUserTest()
        {
            AssignmentCollection tempAssignmentCol = new AssignmentCollection();

            //Create a new assignment, insert it into the database, and then insert it into the Assignment Collection.
            for (int x = 0; x < 10; x++)
            {
                Assignment temp = NewAssignment();
                temp.AssignedTo = "testing";
                InsertAssignmentIntoDatabase(temp);
                tempAssignmentCol.Add(temp);
            }

            //Get all Assignments by that Ticket Id...
            AssignmentCollection tempAssignmentCol2 = HelpdeskService.GetAssignmentsByUser("testing");

            foreach (Assignment temp in tempAssignmentCol)
            {
                Assert.IsTrue(tempAssignmentCol2.Contains(temp), "The new assignment collection did not contain the same data as the original");
            }
            Assert.IsTrue(tempAssignmentCol2.Count >= tempAssignmentCol.Count);
        }
        public void GetResponseByTicketIdTest()
        {
            TicketResponseCollection tempRespCol = new TicketResponseCollection();

            //Create a new module, insert it into the database, and then insert it into the Module Collection.
            for (int x = 0; x < 10; x++)
            {
                TicketResponse tempResp = NewResponse();
                tempResp.TicketId = 1;
                InsertResponseIntoDatabase(tempResp);
                tempRespCol.Add(tempResp);
            }

            //Get all Modules...
            TicketResponseCollection tempRespCol2 = HelpdeskService.GetResponsesByTicketId(1);

            foreach (TicketResponse temp in tempRespCol)
            {
                Assert.IsTrue(tempRespCol2.Contains(temp));
            }

            Assert.IsTrue(tempRespCol2.Count >= tempRespCol.Count);
        }
Esempio n. 22
0
        public void GetAssignmentsByTicketIdTest()
        {
            AssignmentCollection tempAssignmentCol = new AssignmentCollection();

            //Create a new assignment, insert it into the database, and then insert it into the Assignment Collection.
            for (int x = 0; x < 10; x++)
            {
                Assignment temp = NewAssignment();
                temp.TicketId = 0;
                InsertAssignmentIntoDatabase(temp);
                tempAssignmentCol.Add(temp);
            }

            //Get all Assignments by that Ticket Id...
            AssignmentCollection tempAssignmentCol2 = HelpdeskService.GetAssignmentsByTicketId(0);

            foreach (Assignment temp in tempAssignmentCol)
            {
                Assert.IsTrue(tempAssignmentCol2.Contains(temp));
            }

            Assert.IsTrue(tempAssignmentCol2.Count == tempAssignmentCol.Count);
        }
Esempio n. 23
0
        public void EditRequestorTest()
        {
            Requestor temp = NewRequestor();

            InsertRequestorIntoDatabase(temp);

            //Make sure the insertion worked smoothly.
            Assert.IsTrue(temp.Equals(SelectRequestorById(temp.RequestorId)), "The created queue and selected queue do not match.  Insertion or selection might have failed");

            //Change the values...
            temp.FirstName     = "Nathan 2";
            temp.LastName      = "Blevins 2";
            temp.ContactNumber = "423-432-4524";
            temp.Email         = "*****@*****.**";

            //Peform the update.
            HelpdeskService.EditRequestor(temp);

            //Create a new instance of the module object and compare them...
            Requestor temp2 = SelectRequestorById(temp.RequestorId);

            //Make sure they match.
            Assert.IsTrue(temp.Equals(temp2), "The updated queue did not match equality with the prepared module values in the method.");
        }
        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.");
        }
Esempio n. 25
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);
        }
Esempio n. 26
0
 /// <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 InsertAssignmentIntoDatabase(Assignment assignment)
 {
     HelpdeskService.CreateAssignment(assignment);
 }
Esempio n. 27
0
 /// <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);
 }
Esempio n. 28
0
 /// <summary>
 /// Helper method to Select Ticket from database by id, returns null if record is not found.
 /// </summary>
 private Ticket SelectTicketById(int TicketId)
 {
     return(HelpdeskService.GetTicket(TicketId, true));
 }
 /// <summary>
 /// Helper method to Select Response from database by id, returns null if record is not found.
 /// </summary>
 private TicketResponse SelectResponseById(int TicketResponseId)
 {
     return(HelpdeskService.GetResponse(TicketResponseId));
 }
 /// <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);
 }