Exemplo n.º 1
0
        public void TestMinimuInput()
        {
            //Get dummy Bug
            BugTracking.DeveloperBug bug = DeveloperBugSetup.getBug();


            //setup frmCreateBugForm
            BugManager.FrmCreateBug frmCreateBug = new BugManager.FrmCreateBug();
            frmCreateBug.UnitTesting  = true;
            frmCreateBug.LoggedInUser = bug.Location.application.DefaultUser;
            frmCreateBug.BugID        = 0;
            frmCreateBug.Show();
            frmCreateBug.Hide();
            frmCreateBug.cboAssignedUser.SelectedValue = bug.Location.application.DefaultUser.Id;

            //attempt to save without minimul requirements filled in
            frmCreateBug.SaveBug(false);
            Boolean bugPassed = true;

            //if bug hasnt saved then pass
            if (frmCreateBug.BugID != 0)
            {
                bugPassed = false;
            }

            //attempt to save with minimum requirements filled in
            frmCreateBug.txtComment.Text = "Test Comment";

            frmCreateBug.txtTitle.Text = "Test Title";
            frmCreateBug.SaveBug(false);


            //if bug has saved then pass
            if (frmCreateBug.BugID == 0)
            {
                bugPassed = false;
            }

            //check that save was valid
            BugTracking.DeveloperBug checkBug = BugTracking.DeveloperBug.Get(bug.Id);

            //check saved values are correct
            if (checkBug.Title != "Test Title")
            {
                bugPassed = false;
            }

            if (checkBug.Comment != "Test Comment")
            {
                bugPassed = false;
            }

            //delete dummy bug
            DeveloperBugSetup.deleteAllBug(bug);
            Assert.AreEqual(bugPassed, true);
        }
Exemplo n.º 2
0
        public void TestListDeveloperBugCreate()
        {
            //public BugLocation(long applicationID, long formID, long controlID, string action, string relatedMethod, string relatedParameter, long startLineNumber, long endlineNumber)
            //list of Created Bug Ids
            List <long> IDlist = new List <long>();



            //first in List
            BugTracking.DeveloperBug bug = DeveloperBugSetup.getBug();


            IDlist.Add(bug.Id);

            //Second In List
            bug.Title = "Test Title Change";
            bug.Save();
            IDlist.Add(bug.Id);

            //third In List
            bug.Comment = "Test Comment Change";
            bug.Save();
            IDlist.Add(bug.Id);
            //forth In List
            bug.Code = "Dummy Code Change";
            bug.Save();
            IDlist.Add(bug.Id);
            //fith In List
            bug.Location.relatedMethod = "Related Method Test Change";
            bug.Save();
            IDlist.Add(bug.Id);
            //sixth In List
            bug.Location.StartlineNumber = 97;
            bug.Location.EndlineNumber   = 98;
            bug.Save();
            IDlist.Add(bug.Id);



            Boolean AllFound = true;

            //Get Bug History
            List <BugTracking.DeveloperBug> BugHistoryList = BugTracking.DeveloperBug.getBugHistory(IDlist[3]);

            int listPosition = BugHistoryList.Count - 1;



            foreach (BugTracking.DeveloperBug newBug in BugHistoryList)
            {
                if (newBug.Id != IDlist[listPosition])
                {
                    AllFound = false;
                }
                else
                {
                    //Test that each change was kept from previous to next Bug
                    switch (listPosition)
                    {
                    case 5:
                        if (newBug.Location.StartlineNumber != 97)
                        {
                            AllFound = false;
                        }
                        if (newBug.Location.EndlineNumber != 98)
                        {
                            AllFound = false;
                        }

                        break;

                    case 4:
                        if (newBug.Location.relatedMethod != "Related Method Test Change")
                        {
                            AllFound = false;
                        }

                        if (newBug.Location.StartlineNumber != 1)
                        {
                            AllFound = false;
                        }

                        if (newBug.Location.EndlineNumber != 99)
                        {
                            AllFound = false;
                        }

                        break;

                    case 3:
                        if (newBug.Location.relatedMethod != "Related Method Test")
                        {
                            AllFound = false;
                        }

                        if (newBug.Code != "Dummy Code Change")
                        {
                            AllFound = false;
                        }

                        break;

                    case 2:
                        if (newBug.Code != "Dummy Code")
                        {
                            AllFound = false;
                        }
                        ;
                        if (newBug.Comment != "Test Comment Change")
                        {
                            AllFound = false;
                        }

                        break;

                    case 1:
                        if (newBug.Title != "Test Title Change")
                        {
                            AllFound = false;
                        }

                        if (newBug.Comment != "Test Comment")
                        {
                            AllFound = false;
                        }

                        break;

                    case 0:
                        if (newBug.Title != "Test Title")
                        {
                            AllFound = false;
                        }

                        break;
                    }
                }
                //delete bug once checked
                newBug.Delete();
                listPosition -= 1;
            }

            //delete left overs
            DeveloperBugSetup.deleteAllBug(bug);



            Assert.AreEqual(AllFound, true);
        }