public void Save_DataExist_CallDalInsert() { // arrange var expected = SubJenisBrgDataFactory(); _subJenisBrgDal.Setup(x => x.GetData("A1")) .Returns(null as SubJenisBrgModel); // act var actual = _subJenisBrgBL.Save(expected); // assert _subJenisBrgDal.Verify(x => x.Insert(It.IsAny <SubJenisBrgModel>()), Times.Once); _subJenisBrgDal.Verify(x => x.Update(It.IsAny <SubJenisBrgModel>()), Times.Never); }
private void OKButton_Click(object sender, EventArgs e) { var model = new SubJenisBrgModel { SubJenisBrgID = SubJenisBrgIDTextBox.Text, SubJenisBrgName = SubJenisBrgNameTextBox.Text, JenisBrgID = JenisBrgIDTextBox.Text }; var resultSave = _subJenisBrgBL.Save(model); DialogResult = DialogResult.OK; }