コード例 #1
0
        public async Task SubscribersUnderNotification()
        {
            //Arrange
            var controller = new IncidentNotificationController(_dao, _authService, new Microsoft.Extensions.Logging.LoggerFactory());

            SubscriberUnderNotificationWrapper wrapper = new SubscriberUnderNotificationWrapper();

            wrapper.SubscriberUnderNotification = await _dao.GetAllSubscribers();

            //Act
            var result = await controller.SubscribersUnderNotification(wrapper);

            //Assert
            var viewResult = Assert.IsType <OkObjectResult>(result);
        }
コード例 #2
0
        public async Task <IActionResult> SubscribersUnderNotification([FromBody] SubscriberUnderNotificationWrapper wrapper)
        {
            try
            {
                //add subscribers to the incident
                await _dao.AddSubscribersToIncident(wrapper.SubscriberUnderNotification);

                //return all possible subscribers
                return(new OkObjectResult("Successfully added subscribers to incident"));
            }
            catch (Exception e)
            {
                _logger.LogInformation($"Error updating subscribers under notification. The error was: {e.Message}, stack trace was: {e.StackTrace}");
                return(BadRequest($"Error updating subscribers under notification. The error was: {e.Message}"));
            }
        }