public void ChecksumCalculator_When_CalculateMultiplicationChecksum_Called_With_Small_Integer_It_Returns_Checksum()
        {
            var sut = new ChecksumCalculator();

            var checksum = sut.CalculateMultiplicationChecksum(1234);

            Assert.AreEqual(24, checksum);
        }
        public void ChecksumCalculator_When_CalculateMultiplicationChecksum_Called_With_Large_Integer_It_Returns_Checksum()
        {
            var sut = new ChecksumCalculator();

            var checksum = sut.CalculateMultiplicationChecksum(786743259);

            Assert.AreEqual(2540160, checksum);
        }
        public void ChecksumCalculator_When_CalculateMultiplicationChecksum_Called_With_Zero_It_Returns_Zero()
        {
            var sut = new ChecksumCalculator();

            var checksum = sut.CalculateMultiplicationChecksum(0);

            Assert.AreEqual(0, checksum);
        }
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function CalculateMultiplyChecksum processing a request.");

            var numberParameter = req.Query["number"].ToString();

            if (string.IsNullOrEmpty(numberParameter))
            {
                return(new BadRequestObjectResult("Please pass an integer as parameter number on the query string!"));
            }

            if (!int.TryParse(numberParameter, out var number))
            {
                return(new BadRequestObjectResult("Parameter number must be an integer!"));
            }

            var checksumCalculator = new ChecksumCalculator();
            var checksum           = checksumCalculator.CalculateMultiplicationChecksum(number);

            return(new OkObjectResult(checksum));
        }