コード例 #1
0
        public void testGetEmergencyPresenter()
        {
            Mock <IEmergencyView> emergencyView      = new Mock <IEmergencyView>();
            EmergencyPresenter    emergencyPresenter = presenterFactory.getEmergencyPresenter(
                emergencyView.Object, AppointmentRepository.getInstance());

            Assert.IsNotNull(emergencyPresenter);
        }
コード例 #2
0
        public void testCreateEmergencyBooking()
        {
            Mock <IAppointmentRepository> appointmentRepository = new Mock <IAppointmentRepository>();
            Mock <IEmergencyView>         emergencyView         = new Mock <IEmergencyView>();

            emergencyView.Object.bookingDate = DateTime.Now.AddDays(7);
            emergencyView.Object.bookingSlot = "05:00-05:30";
            emergencyView.Object.patientID   = 1;

            //mock appointmentRepository method
            appointmentRepository.Setup(x => x.addBooking(It.IsAny <Appointment>())).Returns(1);

            EmergencyPresenter emergencyPresenter = new
                                                    EmergencyPresenter(emergencyView.Object, appointmentRepository.Object);
            int updatedRecords = emergencyPresenter.CreateEmergencyBooking();

            Assert.AreEqual(1, updatedRecords);
        }