Exemple #1
0
        public void TestAddWords()
        {
            AddWordsBLL bll = new AddWordsBLL();
            bool        actualResult, expectedResult;

            bll._word        = "Dream";
            bll._translation = "सपना";
            bll._wordSet     = "a";
            expectedResult   = true;
            actualResult     = bll.InsertWords();
            Assert.AreEqual(actualResult, expectedResult);
        }
Exemple #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //validation
            if (string.IsNullOrEmpty(txtWord.Text))
            {
                lblError.Text = "Enter a Word.";
                return;
            }
            if (string.IsNullOrEmpty(txtTranslation.Text))
            {
                lblError.Text = "Enter the Translation.";
                return;
            }
            string wordSet;

            //passing values to BLL through setters
            bll._word        = txtWord.Text;
            bll._translation = txtTranslation.Text;
            if (rdoEngA.Checked)
            {
                wordSet = "a";
            }
            else if (rdoEngB.Checked)
            {
                wordSet = "b";
            }
            else
            {
                lblError.Text = "Select a Word Set!!!!";
                return;
            }
            bll._wordSet = wordSet;
            //to insert and update according to texts in btnAdd
            if (btnAdd.Text == "Add")
            {
                bll.InsertWords();//method in BLL that insert word
            }
            else if (btnAdd.Text == "Update")
            {
                bll.UpdateWord();//method in BLL that updates word
            }
            LoadDataGrid();
            Clear();
        }