示例#1
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", 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 getJobConfigHelper = new GetJobConfigHelper(logWrapper, context);
                return(await getJobConfigHelper.RunAsync(channelId));
            }
        }
示例#2
0
        public async Task RunAsync()
        {
            const decimal channelId = 123;

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

            _Context.Setup(s => s.GetJobConfig(channelId)).ReturnsAsync(container);
            _Log.Setup(s => s.LogInformation($"Channel {channelId} got job config."));
            var result = await _GetJobConfigHelper.RunAsync(channelId);

            _Log.VerifyAll();
            _Context.VerifyAll();
            var okObjectResult = result as OkObjectResult;

            Assert.That(okObjectResult, Is.Not.Null);
            Assert.That(okObjectResult.Value, Is.EqualTo(container));
        }