コード例 #1
0
        public JenisBrgModel Save(JenisBrgModel jenisBrg)
        {
            //  validasi
            var result = jenisBrg;

            result = TryValidate(jenisBrg);

            //  save
            var dummyJenisBrg = _jenisBrgDal.GetData(jenisBrg.JenisBrgID);

            if (dummyJenisBrg == null)
            {
                _jenisBrgDal.Insert(result);
            }
            else
            {
                _jenisBrgDal.Update(result);
            }
            return(result);
        }
コード例 #2
0
        public void GetData_ValidData_NoEx()
        {
            using (var trans = TransHelper.NewScope())
            {
                //  arrange
                var expected = JenisBrgDataFactory();
                _jenisBrgDal.Insert(expected);

                //  act
                var actual = _jenisBrgDal.GetData("A1");

                //  assert
                actual.Should().BeEquivalentTo(expected);
            }
        }