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)); }
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)); }
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(); }
public void Task_Add_TwoNumber() { // Arrange var num1 = 2.9; var num2 = 3.1; var expectedValue = 6; // Act var sum = MathOperationService.Add(num1, num2); //Assert Assert.Equal(expectedValue, sum, 1); }