public void ChecksumCalculator_When_CalculateAdditionChecksum_Called_With_Zero_It_Returns_Zero() { var sut = new ChecksumCalculator(); var checksum = sut.CalculateAdditionChecksum(0); Assert.AreEqual(0, checksum); }
public void ChecksumCalculator_When_CalculateAdditionChecksum_Called_With_Small_Integer_It_Returns_Checksum() { var sut = new ChecksumCalculator(); var checksum = sut.CalculateAdditionChecksum(1234); Assert.AreEqual(10, checksum); }
public void ChecksumCalculator_When_CalculateAdditionChecksum_Called_With_Large_Integer_It_Returns_Checksum() { var sut = new ChecksumCalculator(); var checksum = sut.CalculateAdditionChecksum(786743259); Assert.AreEqual(51, checksum); }
public static IActionResult Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function CalculateAddChecksum 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.CalculateAdditionChecksum(number); return(new OkObjectResult(checksum)); }