public void RepromptsWhenResponseAboveMaxValue(string response, decimal maxValue) { var(stdOut, stdIn) = TestFx.ConsoleDefaults(); (decimal result, string output) = TestFx.RepromptWithInvalidFirstDecimalResponse("", response, $"{maxValue - 1}", null, maxValue); Assert.Equal(maxValue - 1, result); TestFx.ResetConsole(stdOut, stdIn); }
public void RepromptsWhenResponseBelowMinValue(string response, decimal minValue) { var(stdOut, stdIn) = TestFx.ConsoleDefaults(); (decimal result, string output) = TestFx.RepromptWithInvalidFirstDecimalResponse("", response, $"{minValue + 1}", minValue); Assert.Equal(minValue + 1, result); TestFx.ResetConsole(stdOut, stdIn); }
[InlineData("-79228162514264337593543950336")] // One below decimal.MinValue public void DoesNotOutputHelpMessageWithVerboseOff(string response) { var(stdOut, stdIn) = TestFx.ConsoleDefaults(); (decimal result, string output) = TestFx.RepromptWithInvalidFirstDecimalResponse("", response, "15", verbose: false); Assert.DoesNotContain("decimal value", output); TestFx.ResetConsole(stdOut, stdIn); }
[InlineData("-79228162514264337593543950336")] // One below decimal.MinValue public void RepromptsWhenResponseIsInvalid(string response) { var(stdOut, stdIn) = TestFx.ConsoleDefaults(); (decimal result, string output) = TestFx.RepromptWithInvalidFirstDecimalResponse("", response, "15", int.MinValue); Assert.Equal(15, result); TestFx.ResetConsole(stdOut, stdIn); }
[InlineData("-79228162514264337593543950336")] // One below decimal.MinValue public void OutputsHelpMessageWithInvalidResponse(string response) { var(stdOut, stdIn) = TestFx.ConsoleDefaults(); (decimal result, string output) = TestFx.RepromptWithInvalidFirstDecimalResponse("", response, "15"); string expected = $"Please supply a decimal value between {decimal.MinValue} and {decimal.MaxValue}."; Assert.Contains(expected, output); TestFx.ResetConsole(stdOut, stdIn); }