Beispiel #1
0
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestMessage req, TraceWriter log)
        {
            IMathOperationService    mathService = new MathOperationService(20, 5);
            Dictionary <string, int> obj         = new Dictionary <string, int>();

            log.Info($"Add - {mathService.Add()}");
            obj.Add("Add", mathService.Add());

            log.Info($"Sub - {mathService.Sub()}");
            obj.Add("Sub", mathService.Sub());

            log.Info($"Mul - {mathService.Mul()}");
            obj.Add("Mul", mathService.Mul());

            log.Info($"Div - {mathService.Div()}");
            obj.Add("Div", mathService.Div());

            return(req.CreateResponse(HttpStatusCode.OK, obj));
        }
Beispiel #2
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req, ILogger log)
        {
            IMathOperationService    mathService = new MathOperationService(20, 5);
            Dictionary <string, int> obj         = new Dictionary <string, int>();

            log.LogInformation($"Add - {mathService.Add()}");
            obj.Add("Add", mathService.Add());

            log.LogInformation($"Sub - {mathService.Sub()}");
            obj.Add("Sub", mathService.Sub());

            log.LogInformation($"Mul - {mathService.Mul()}");
            obj.Add("Mul", mathService.Mul());

            log.LogInformation($"Div - {mathService.Div()}");
            obj.Add("Div", mathService.Div());

            return((ActionResult) new OkObjectResult(obj));
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            IMathOperationService mathService = new MathOperationService(20, 10);

            Console.WriteLine($"Add - {mathService.Add()}");
            Console.WriteLine($"Sub - {mathService.Sub()}");
            Console.WriteLine($"Div - {mathService.Div()}");
            Console.WriteLine($"Mul - {mathService.Mul()}");
            Console.ReadLine();
        }