public void GeneratePassword_WithInvalidLength_ShouldReturnBadRequest(int length) { // Arrange // Act IActionResult result = _controller.GeneratePassword(length); // Assert var objectResult = Assert.IsType <BadRequestObjectResult>(result); Assert.Equal("The length must be greater than or equal to 1 and less than or equal to 300.", objectResult.Value); }