public void ReportByDescriptionTestDataFound()
        {
            ClsPositionCollection filteredPosition = new ClsPositionCollection();
            bool ok = true;

            filteredPosition.ReportByDescription("xxxxx");

            if (filteredPosition.Count == 2)
            {
                if (filteredPosition.PositionList[0].PositionID != 9)
                {
                    ok = false;
                }


                if (filteredPosition.PositionList[1].PositionID != 9)
                {
                    ok = false;
                }
            }
            else
            {
                ok = false;
            }

            Assert.IsTrue(ok);
        }
        public void ReportByDescriptionNotFound()
        {
            ClsPositionCollection filteredPosition = new ClsPositionCollection();

            filteredPosition.ReportByDescription("xxxxx");

            Assert.AreEqual(2, filteredPosition.Count);
        }
    protected void BtnOK_Click(object sender, EventArgs e)
    {
        ClsPositionCollection positionCollection = new ClsPositionCollection();

        positionCollection.ThisPosition.Find(positionID);
        positionCollection.Delete();
        Response.Redirect("PositionList.aspx");
    }
        public void ReportByDescriptionMethodOK()
        {
            ClsPositionCollection allPosition      = new ClsPositionCollection();
            ClsPositionCollection filteredPosition = new ClsPositionCollection();

            filteredPosition.ReportByDescription("");

            Assert.AreEqual(allPosition.Count, filteredPosition.Count);
        }
    void DisplayPosition()
    {
        ClsPositionCollection positions = new ClsPositionCollection();

        LbPositionList.DataSource     = positions.PositionList;
        LbPositionList.DataValueField = "PositionID";
        LbPositionList.DataTextField  = "Description";
        LbPositionList.DataBind();
    }
    protected void BtnApply_Click(object sender, EventArgs e)
    {
        ClsPositionCollection positions = new ClsPositionCollection();

        positions.ReportByDescription(TbDescriptionFilter.Text);
        LbPositionList.DataSource     = positions.PositionList;
        LbPositionList.DataValueField = "PositionID";
        LbPositionList.DataTextField  = "Description";
        LbPositionList.DataBind();
    }
Example #7
0
    void DisplayPosition()
    {
        ClsPositionCollection positions = new ClsPositionCollection();

        positions.ThisPosition.Find(positionID);

        TbPositionID.Text   = positions.ThisPosition.PositionID.ToString();
        TbPositionName.Text = positions.ThisPosition.PositionName;
        TbDescription.Text  = positions.ThisPosition.Description;
        TbSalary.Text       = positions.ThisPosition.Salary.ToString();
    }
        public void ThisPositionPropertyOK()
        {
            ClsPositionCollection allPosition  = new ClsPositionCollection();
            ClsPosition           testPosition = new ClsPosition();

            testPosition.PositionID   = 1;
            testPosition.PositionName = "Software Engineer";
            testPosition.Description  = "Develop and deploy software.";
            testPosition.Salary       = 35000.00M;

            allPosition.ThisPosition = testPosition;
            Assert.AreEqual(allPosition.ThisPosition, testPosition);
        }
        public void ListAndCountOK()
        {
            ClsPositionCollection allPosition = new ClsPositionCollection();
            List <ClsPosition>    testList    = new List <ClsPosition>();
            ClsPosition           testItem    = new ClsPosition();

            testItem.PositionID   = 1;
            testItem.PositionName = "Software Engineer";
            testItem.Description  = "Develop and deploy software.";
            testItem.Salary       = 35000.00M;

            testList.Add(testItem);
            allPosition.PositionList = testList;
            Assert.AreEqual(allPosition.Count, testList.Count);
        }
        public void AddMethodOK()
        {
            ClsPositionCollection allPosition = new ClsPositionCollection();
            ClsPosition           testItem    = new ClsPosition();

            int primaryKey = 0;

            testItem.PositionID   = 12;
            testItem.PositionName = "Web Designer";
            testItem.Description  = "Create the look, layout, and features of a website.";
            testItem.Salary       = 40000.00M;

            allPosition.ThisPosition = testItem;

            primaryKey = allPosition.Add();

            testItem.PositionID = primaryKey;

            Assert.AreEqual(allPosition.ThisPosition, testItem);
        }
        public void DeleteMethodOK()
        {
            ClsPositionCollection allPosition = new ClsPositionCollection();
            ClsPosition           testItem    = new ClsPosition();

            int primaryKey = 0;

            testItem.PositionID   = 1;
            testItem.PositionName = "Software Engineer";
            testItem.Description  = "Develop and deploy software.";
            testItem.Salary       = 35000.00M;

            allPosition.ThisPosition = testItem;
            primaryKey          = allPosition.Add();
            testItem.PositionID = primaryKey;
            allPosition.ThisPosition.Find(primaryKey);

            allPosition.Delete();
            bool found = allPosition.ThisPosition.Find(primaryKey);

            Assert.IsFalse(found);
        }
Example #12
0
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        ClsPosition position     = new ClsPosition();
        string      positionName = TbPositionName.Text;
        string      description  = TbDescription.Text;
        string      salary       = TbSalary.Text;

        string error = "";

        error = position.Valid(positionName, description, salary);
        if (error == "")
        {
            position.PositionID   = positionID;
            position.PositionName = positionName;
            position.Description  = description;
            position.Salary       = Decimal.Parse(salary);

            ClsPositionCollection positionList = new ClsPositionCollection();

            if (positionID == -1)
            {
                positionList.ThisPosition = position;
                positionList.Add();
            }
            else
            {
                positionList.ThisPosition.Find(positionID);
                positionList.ThisPosition = position;
                positionList.Update();
            }

            Response.Redirect("PositionList.aspx");
        }
        else
        {
            LblError.Text = error;
        }
    }
        public void UpdateMethodOK()
        {
            ClsPositionCollection allPosition = new ClsPositionCollection();
            ClsPosition           testItem    = new ClsPosition();

            int primaryKey = 0;

            testItem.PositionName = "Software Engineer";
            testItem.Description  = "Develop and deploy software.";
            testItem.Salary       = 35000.00M;

            allPosition.ThisPosition = testItem;
            primaryKey = allPosition.Add();

            testItem.PositionName = "Penetration Tester";
            testItem.Description  = "";
            testItem.Salary       = 50000.00M;

            allPosition.ThisPosition = testItem;
            allPosition.Update();
            allPosition.ThisPosition.Find(primaryKey);

            Assert.AreEqual(allPosition.ThisPosition, testItem);
        }
        public void InstanceOK()
        {
            ClsPositionCollection allPosition = new ClsPositionCollection();

            Assert.IsNotNull(allPosition);
        }