예제 #1
0
        public SubJenisBrgModel Save(SubJenisBrgModel subJenisBrg)
        {
            //  validasi
            var result = subJenisBrg;

            result = TryValidate(subJenisBrg);

            //  save
            var dummySubJenisBrg = _subJenisBrgDal.GetData(subJenisBrg.SubJenisBrgID);

            if (dummySubJenisBrg == null)
            {
                _subJenisBrgDal.Insert(result);
            }
            else
            {
                _subJenisBrgDal.Update(result);
            }

            return(result);
        }
예제 #2
0
        public void GetData_ValidData_NoEx()
        {
            using (var trans = TransHelper.NewScope())
            {
                //  arrange
                var expected = SubJenisBrgDataFactory();
                _subJenisBrgDal.Insert(expected);

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

                //  assert
                actual.Should().BeEquivalentTo(expected,
                                               config => config
                                               .Excluding(x => x.JenisBrgName));
            }
        }