예제 #1
0
        public async Task ThrowsForNoWorkOrder()
        {
            _repairGatewayMock.Setup(rgm => rgm.GetWorkOrder(It.IsAny <int>())).ReturnsAsync((WorkOrder)null);

            Func <Task> func = async() => await _classUnderTest.Execute("1", 1);

            await func.Should().ThrowAsync <ResourceNotFoundException>();
        }
        public async Task <IActionResult> CreateAppointment([FromBody] RequestAppointment appointmentRequest)
        {
            try
            {
                var appointmentId = appointmentRequest.AppointmentReference.ID;
                var workOrderId   = int.Parse(appointmentRequest.WorkOrderReference.ID);
                await _createAppointmentUseCase.Execute(appointmentId, workOrderId, appointmentRequest.Notes);

                return(Ok());
            }
            catch (FormatException)
            {
                return(BadRequest("Invalid Id formats. they must be integers"));
            }
        }