public void Test_IsForcePowerInList_ListForcePowerParam_BadResult()
        {
            bool       blnIsInList    = false;
            ForcePower objForcePower  = new ForcePower();
            ForcePower objForcePower2 = new ForcePower();
            ForcePower objForcePower3 = new ForcePower();

            ForcePower objForcePower4 = new ForcePower();
            ForcePower objForcePower5 = new ForcePower();

            List <ForcePower> lstForcePower  = new List <ForcePower>();
            List <ForcePower> lstForcePower2 = new List <ForcePower>();

            objForcePower.GetForcePower(1);
            objForcePower2.GetForcePower(2);
            objForcePower3.GetForcePower(7);

            objForcePower4.GetForcePower(8);
            objForcePower5.GetForcePower(9);

            lstForcePower.Add(objForcePower);
            lstForcePower.Add(objForcePower2);
            lstForcePower.Add(objForcePower3);

            lstForcePower2.Add(objForcePower4);
            lstForcePower2.Add(objForcePower5);


            blnIsInList = ForcePower.IsForcePowerInList(lstForcePower2, lstForcePower);
            Assert.IsFalse(blnIsInList);
        }
Example #2
0
        /// <summary>
        /// Handles the Click event of the btnAddFP control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnAddFP_Click(object sender, EventArgs e)
        {
            string strTag = tvForcePowerList.SelectedNode.Tag.ToString();
            int    intTag;

            int.TryParse(strTag, out intTag);

            if (intTag != 0)
            {
                ForcePower objForcePower = new ForcePower();
                objForcePower.GetForcePower(intTag);

                //add it to the force power selected tree view
                TreeNode objTN = new TreeNode();
                objTN.Text = objForcePower.ForcePowerName;
                objTN.Tag  = objForcePower.ForcePowerID;
                tvSelectedForcePowers.Nodes.Add(objTN);

                bool blnAllButton;
                if (this.tvSelectedForcePowers.Nodes.Count > 0)
                {
                    blnAllButton = true;
                }
                else
                {
                    blnAllButton = false;
                }
                SetFPSelectButtons(false, false, blnAllButton);
                //this.btnAddFP.Enabled = false;
                SetForcePowerFields("");
            }
        }
        public void Test_GetForcePower_ByID_GoodResult()
        {
            int        intForcePowerID = 1;
            ForcePower objForcePower   = new ForcePower();

            objForcePower.GetForcePower(intForcePowerID);

            Assert.AreEqual(intForcePowerID, objForcePower.ForcePowerID);
        }
        public void Test_GetForcePower_ByName_BadResult()
        {
            string     strForcePowerName = "blah blah";
            ForcePower objForcePower     = new ForcePower();

            objForcePower.GetForcePower(strForcePowerName);

            Assert.IsNull(objForcePower.ForcePowerName);
        }
        public void Test_GetForcePower_ByName_GoodResult()
        {
            string     strForcePowerName = "Force Grip";
            ForcePower objForcePower     = new ForcePower();

            objForcePower.GetForcePower(strForcePowerName);

            Assert.AreEqual(strForcePowerName, objForcePower.ForcePowerName);
        }
        public void Test_GetForcePower_ByID_BadResult()
        {
            int        intForcePowerID = 0;
            ForcePower objForcePower   = new ForcePower();

            objForcePower.GetForcePower(intForcePowerID);

            Assert.IsNull(objForcePower.ForcePowerName);
        }
Example #7
0
        /// <summary>
        /// Handles the Click event of the btnSelectForcePower control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnSelectForcePower_Click(object sender, EventArgs e)
        {
            string strTag = "";
            int    intTag = 0;

            foreach (TreeNode objTN in tvSelectedForcePowers.Nodes)
            {
                strTag = objTN.Tag.ToString();
                int.TryParse(strTag, out intTag);
                ForcePower objForcePower = new ForcePower();
                objForcePower.GetForcePower(intTag);
                objCALC.lstNewForcePowers.Add(objForcePower);
            }

            this.Close();
        }
        public void FillFormWithForcePower(int ForcePowerID)
        {
            ForcePower ForcePower = new ForcePower();

            ForcePower.GetForcePower(ForcePowerID);

            if (ForcePower.ForcePowerID != 0)
            {
                SetForm(ForcePower, false);
            }
            if (dbconn.Open)
            {
                dbconn.CloseDatabaseConnection();
            }
            this.btnSave.Enabled = false;
            this.btnNew.Enabled  = true;
            this.btnEdit.Enabled = true;
        }
        public void Test_IsForcePowerInList_SingleClassParam_GoodResult()
        {
            bool              blnIsInList    = false;
            ForcePower        objForcePower  = new ForcePower();
            ForcePower        objForcePower2 = new ForcePower();
            ForcePower        objForcePower3 = new ForcePower();
            List <ForcePower> lstForcePower  = new List <ForcePower>();

            objForcePower.GetForcePower(1);
            objForcePower2.GetForcePower(2);
            objForcePower3.GetForcePower(7);

            lstForcePower.Add(objForcePower);
            lstForcePower.Add(objForcePower2);
            lstForcePower.Add(objForcePower3);

            blnIsInList = ForcePower.IsForcePowerInList(objForcePower, lstForcePower);

            Assert.IsTrue(blnIsInList);
        }
Example #10
0
        /// <summary>
        /// Sets the force power fields describing the selected ForcePower (from either tree).
        /// </summary>
        /// <param name="strTag">The Tag (string) from the selected ForcePower TreeNode object from either TreeView Control.</param>
        public void SetForcePowerFields(string strTag)
        {
            //string strTag = tvForcePowerList.SelectedNode.Tag.ToString();
            int intTag;

            int.TryParse(strTag, out intTag);

            if (intTag != 0)
            {
                ForcePower objForcePower = new ForcePower();
                objForcePower.GetForcePower(intTag);

                this.txtForcePowerName.Text        = objForcePower.ForcePowerName;
                this.txtForcePowerDescription.Text = objForcePower.ForcePowerDescription;
                this.txtForcePowerSpecial.Text     = objForcePower.ForcePowerSpecial;
                this.txtForcePowerTarget.Text      = objForcePower.ForcePowerTarget;
                this.txtTurnSegment.Text           = objForcePower.objTurnSegment.TurnSegmentName;

                this.tvForcePowerDescriptor.Nodes.Clear();
                if (objForcePower.objForcePowerDescriptors != null)
                {
                    foreach (ForcePowerDescriptor objFPD in objForcePower.objForcePowerDescriptors)
                    {
                        TreeNode objTN = new TreeNode();
                        objTN.Text = objFPD.ForcePowerDescriptorName;
                        objTN.Tag  = objFPD.ForcePowerDescriptorID;
                        tvForcePowerDescriptor.Nodes.Add(objTN);
                    }
                }
            }
            else
            {
                this.txtForcePowerName.Text        = "";
                this.txtForcePowerDescription.Text = "";
                this.txtForcePowerSpecial.Text     = "";
                this.txtForcePowerTarget.Text      = "";
                this.txtTurnSegment.Text           = "";

                this.tvForcePowerDescriptor.Nodes.Clear();
            }
        }
        public void Test_SaveAndDeleteCharacterForcePower()
        {
            bool       returnVal;
            int        CharacterID  = 1;
            int        ForcePowerID = 55;
            ForcePower objFP        = new ForcePower();

            objFP.GetForcePower(ForcePowerID);

            List <ForcePower> lstCharFP = new List <ForcePower>();

            ForcePower objFP2 = new ForcePower();

            objFP2.SaveCharacterForcePower(CharacterID, ForcePowerID);
            lstCharFP = objFP2.GetCharacterForcePowers(CharacterID);

            Assert.IsTrue(ForcePower.IsForcePowerInList(objFP, lstCharFP));

            returnVal = objNewForcePower.DeleteCharacterForcePower(CharacterID, ForcePowerID);

            Assert.IsTrue(returnVal && objNewForcePower.DeleteOK);
        }