示例#1
0
        public void JadwalTglBL_Save_Succeed_Test()
        {
            //  arrange
            var jadwal = new JadwalTglModel
            {
                KodeDokter  = "A",
                KodeLayanan = "B",
                TglJadwal   = "01-01-2017",
                Jam         = "09:00",
                Max         = 4,
                Booked      = 1
            };

            _layananBL.Stub(x => x.GetById("A")).Return(new LayananModel());
            _dokterBL.Stub(x => x.GetById("B")).Return(new DokterModel());
            _jadwalTglDal.Stub(x => x.IsExist("A", "01-01-2017", "09:00")).Return(true);
            //  act
            _jadwalTglBL.Save(jadwal);

            //  assert
            _jadwalTglDal.AssertWasCalled(x => x.Insert(Arg <JadwalTglModel> .Is.Anything));
        }
        public void JadwalHariBL_Save_New_Succeed_Test()
        {
            //  arrange
            var jadwal = new JadwalHariModel
            {
                Kode          = "",
                KodeDokter    = "A",
                KodeLayanan   = "A",
                Hari          = 2,
                JamMulai      = "08:00",
                JamSelesai    = "10:00",
                JadwalPerJams = new List <JadwalHariPerJamModel>
                {
                    new JadwalHariPerJamModel {
                        Jam = "08:00", Max = 4, Booked = 1
                    },
                    new JadwalHariPerJamModel {
                        Jam = "09:00", Max = 4, Booked = 0
                    }
                }
            };

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

            //  act
            _jadwalHariBL.Save(jadwal);

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