Exemple #1
0
        public void Sum_One_And_Two_Not_Equal_Five()
        {
            var sumService = new SumService();

            var result = sumService.Sum(1, 2);

            Assert.AreEqual(3, result);
        }
Exemple #2
0
        public void Sum_One_And_One()
        {
            var sumService = new SumService();
            // act (акт)
            var result = sumService.Sum(1, 1);

            // assert (утверждение)
            Assert.AreEqual(2, result);
        }
        public static void Run([QueueTrigger("sum-items", Connection = "AzureWebJobsStorage")] string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");

            var item    = JsonConvert.DeserializeObject <SumItem>(myQueueItem);
            var service = new SumService();
            var output  = service.Sum(item);

            log.LogInformation("The sum is {0}", output);
        }
Exemple #4
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            var    item        = JsonConvert.DeserializeObject <SumItem>(requestBody);
            var    service     = new SumService();
            var    output      = service.Sum(item);

            log.LogInformation("The sum is {0}", output);

            return(new OkObjectResult(output));
        }
 public void ShouldReturn5()
 {
     Assert.Equal(5, SumService.Sum(2, 3));
 }