Exemple #1
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "delete", Route = "jobconfigs/{channelid:decimal}")] HttpRequest req, decimal channelId, ILogger log)
        {
            var connectionString = Environment.GetEnvironmentVariable("TrendingGiphyBotConnectionString");
            var logWrapper       = new LoggerWrapper(log);

            using (var context = new TrendingGiphyBotContext(connectionString))
            {
                var deleteJobConfigHelper = new DeleteJobConfigHelper(logWrapper, context);
                return(await deleteJobConfigHelper.RunAsync(channelId));
            }
        }
        public async Task RunAsync()
        {
            const decimal channelId = 123;

            _Log.Setup(s => s.LogInformation($"Channel {channelId} deleting job config."));
            var container = new JobConfigContainer();

            _Context.Setup(s => s.DeleteJobConfig(channelId)).Returns(Task.CompletedTask);
            _Log.Setup(s => s.LogInformation($"Channel {channelId} deleted job config."));
            var result = await _DeleteJobConfigHelper.RunAsync(channelId);

            _Log.VerifyAll();
            _Context.VerifyAll();
            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.InstanceOf <NoContentResult>());
        }