public IHttpActionResult Save(DokterModel layanan)
 {
     try
     {
         _dokterBL.Save(layanan);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Exemplo n.º 2
0
        public void DokterBL_Save_New_Succeed_Test()
        {
            //  arrange
            var dokter = new DokterModel
            {
                Kode          = "A",
                Nama          = "Data1",
                KodeLayanan   = "B",
                NamaLayanan   = "Data2",
                PhotoFileName = "Data3"
            };

            _dokterDal.Stub(x => x.GetById("A")).Return(null);
            _layananBL.Stub(x => x.GetById("B")).Return(new LayananModel
            {
                Kode = "B",
                Nama = "Data2"
            });

            //  act
            _dokterBL.Save(dokter);

            //  assert
            _dokterDal.AssertWasCalled(x => x.Insert(Arg <DokterModel> .Is.Anything));
        }