コード例 #1
0
        public void testGetCheckUpPresenter()
        {
            Mock <ICheckupView> checkupView      = new Mock <ICheckupView>();
            CheckUpPresenter    checkUpPresenter = presenterFactory.getCheckUpPresenter(
                checkupView.Object, AppointmentRepository.getInstance());

            Assert.IsNotNull(checkUpPresenter);
        }
コード例 #2
0
        public void testCreateCheckupBooking()
        {
            Mock <IAppointmentRepository> appointmentRepository = new Mock <IAppointmentRepository>();
            Mock <ICheckupView>           checkupView           = new Mock <ICheckupView>();

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

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

            CheckUpPresenter checkUpPresenter = new CheckUpPresenter(checkupView.Object, appointmentRepository.Object);
            int updatedRecords = checkUpPresenter.CreateCheckupBooking();

            Assert.AreEqual(1, updatedRecords);
        }