コード例 #1
0
        public void ValidMethodOK()
        {
            ClsPosition position = new ClsPosition();
            string      error    = "";

            error = position.Valid(positioName, description, salary);
            Assert.AreEqual(error, "");
        }
コード例 #2
0
        public void PositionNamePropertyOK()
        {
            ClsPosition position = new ClsPosition();
            string      testData = "Software Engineer";

            position.PositionName = testData;
            Assert.AreEqual(position.PositionName, testData);
        }
コード例 #3
0
        public void DescriptionPropertyOK()
        {
            ClsPosition position = new ClsPosition();
            string      testData = "Develops software solutions";

            position.Description = testData;
            Assert.AreEqual(position.Description, testData);
        }
コード例 #4
0
        public void PositionIDPropertyOK()
        {
            ClsPosition position = new ClsPosition();
            int         testData = 112;

            position.PositionID = testData;
            Assert.AreEqual(position.PositionID, testData);
        }
コード例 #5
0
        public void SalaryPropertyOK()
        {
            ClsPosition position = new ClsPosition();
            decimal     testData = 50000.00M;

            position.Salary = testData;
            Assert.AreEqual(position.Salary, testData);
        }
コード例 #6
0
        public void SalaryMinPlus1()
        {
            ClsPosition position = new ClsPosition();

            string error  = "";
            string salary = "AA";

            error = position.Valid(positioName, description, salary);

            Assert.AreEqual(error, "");
        }
コード例 #7
0
        public void DescriptionMinLess1()
        {
            ClsPosition position = new ClsPosition();

            string error       = "";
            string description = "";

            error = position.Valid(positioName, description, salary);

            Assert.AreNotEqual(error, "");
        }
コード例 #8
0
        public void PositionNameMin()
        {
            ClsPosition position = new ClsPosition();

            string error = "";
            string name  = "A";

            error = position.Valid(name, description, salary);

            Assert.AreEqual(error, "");
        }
コード例 #9
0
        public void DescriptionMaxPlus1()
        {
            ClsPosition position = new ClsPosition();

            string error       = "";
            string description = "";

            description = description.PadRight(101, 'A');

            error = position.Valid(positioName, description, salary);

            Assert.AreNotEqual(error, "");
        }
コード例 #10
0
        public void PositionNameMaxExtreme()
        {
            ClsPosition position = new ClsPosition();

            string error = "";
            string name  = "";

            name = name.PadRight(500, 'A');

            error = position.Valid(name, description, salary);

            Assert.AreNotEqual(error, "");
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        public void SalaryMaxExtreme()
        {
            ClsPosition position = new ClsPosition();

            string error  = "";
            string salary = "";

            salary = salary.PadRight(500, 'A');

            error = position.Valid(positioName, description, salary);

            Assert.AreNotEqual(error, "");
        }
コード例 #13
0
        public void TestSalaryFound()
        {
            ClsPosition position   = new ClsPosition();
            bool        Found      = false;
            bool        OK         = true;
            int         PositionID = 1;

            Found = position.Find(PositionID);
            if (position.Salary != 35000.00M)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
コード例 #14
0
        public void TestDescriptionFound()
        {
            ClsPosition position   = new ClsPosition();
            bool        Found      = false;
            bool        OK         = true;
            int         positionID = 1;

            Found = position.Find(positionID);
            if (position.Description != "Develop and deploy software.")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
コード例 #15
0
        public void TestPositionNameFound()
        {
            ClsPosition position   = new ClsPosition();
            bool        Found      = false;
            bool        OK         = true;
            int         PositionID = 1;

            Found = position.Find(PositionID);
            if (position.PositionName != "Software Engineer")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
コード例 #16
0
        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);
        }
コード例 #17
0
        //[TestMethod]
        public void TestPositionIDFound()
        {
            ClsPosition position = new ClsPosition();

            bool Found      = false;
            bool OK         = true;
            int  PositionID = 1;

            Found = position.Find(PositionID);

            if (position.PositionID != 1)
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }
コード例 #18
0
        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);
        }
コード例 #19
0
    protected void BtnFind_Click(object sender, EventArgs e)
    {
        ClsPosition position = new ClsPosition();
        Int32       positionID;
        Boolean     Found = false;

        if (System.Text.RegularExpressions.Regex.IsMatch(TbPositionID.Text, "^[a-zA-Z]*$"))
        {
            Response.Redirect("PositionPage.aspx");
        }

        positionID = Convert.ToInt32(TbPositionID.Text);
        Found      = position.Find(positionID);

        if (Found == true)
        {
            TbPositionName.Text = position.PositionName;
            TbDescription.Text  = position.Description;
            TbSalary.Text       = position.Salary.ToString();
        }
    }
コード例 #20
0
        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);
        }
コード例 #21
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;
        }
    }
コード例 #22
0
        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);
        }
コード例 #23
0
        public void InstanceOK()
        {
            ClsPosition position = new ClsPosition();

            Assert.IsNotNull(position);
        }