public async Task NumberChecker_LowerThanCorrectNumber_TooLowMessage() { // Arrange _expectedCheckResult = Resources.TooLowMessage; _numberToCheck = Resources.CorrectNumber - 1; // Act _actualCheckResult = await NumberChecker.CheckNumber(_numberToCheck); // Assert Check.That(_actualCheckResult).Equals(_expectedCheckResult); }
public async Task Invoke(HttpContext httpContext) { if (httpContext.Request.Path.HasValue && httpContext.Request.Path.Value.Contains("primecheck")) { string value = httpContext.Request.Path.Value.Replace("/", "").Replace("primecheck", ""); int valuetocheck = (string.IsNullOrEmpty(value) || value == "0") ? 1 : Convert.ToInt32(value); if (_checker.CheckNumber(valuetocheck)) { await httpContext.Response.WriteAsync("is prime"); } else { await httpContext.Response.WriteAsync("is not prime"); } } else { await _next(httpContext); } }
public void Prime(int number, bool expectedResult) { _calculator.CheckNumber(number).Should().Be(expectedResult); }