public void Save_DataExist_CallDalInsert() { // arrange var expected = UserrDataFactory(); _userrDal.Setup(x => x.GetData("A1")) .Returns(null as UserrModel); // act var actual = _userrBL.Save(expected); // assert _userrDal.Verify(x => x.Insert(It.IsAny <UserrModel>()), Times.Once); _userrDal.Verify(x => x.Update(It.IsAny <UserrModel>()), Times.Never); }
private void OkButton_Click(object sender, EventArgs e) { var userrName = textBox1.Text; var pass1 = PasswordTextBox.Text; var pass2 = maskedTextBox1.Text; var jenis = "F"; if (radioButton2.Checked) { jenis = "A"; } try { _userrBL.Save(userrName, pass1, pass2, jenis); } catch (ArgumentException ex) { MessageBox.Show(ex.Message); } textBox1.Text = ""; PasswordTextBox.Text = ""; maskedTextBox1.Text = ""; }