public void Save_DataExist_CallDalInsert() { // arrange var expected = JenisBrgDataFactory(); _jenisBrgDal.Setup(x => x.GetData("A1")) .Returns(null as JenisBrgModel); // act var actual = _jenisBrgBL.Save(expected); // assert _jenisBrgDal.Verify(x => x.Insert(It.IsAny <JenisBrgModel>()), Times.Once); _jenisBrgDal.Verify(x => x.Update(It.IsAny <JenisBrgModel>()), Times.Never); }
private void OKButton_Click(object sender, EventArgs e) { var jenisBrg = new JenisBrgModel { JenisBrgID = JenisBrgIDTextBox.Text, JenisBrgName = JenisBrgNameTextBox.Text }; var result = _jenisBrgBL.Save(jenisBrg); DialogResult = DialogResult.OK; }