コード例 #1
0
        public void GetAppointmentById()
        {
            Appointment appointment = new Appointment()
            {
                Id = 1
            };

            mockService.Setup(x => x.GetAppointment(1)).Returns(appointment);

            AppointmentController controller = new AppointmentController(mockService.Object);

            Models.AppointmentResponse response = controller.Get(1);
            Assert.AreEqual(1, response.Appointment.Id);
        }
コード例 #2
0
        public void AppointmentNotFound()
        {
            Appointment appointment = new Appointment()
            {
                Id = 2
            };

            mockService.Setup(x => x.GetAppointment(2)).Returns(appointment);

            AppointmentController controller = new AppointmentController(mockService.Object);

            Models.AppointmentResponse response = controller.Get(1);
            Assert.IsFalse(response.Success);
        }