public void UseStd3AsciiRules_ChangesGetAsciiBehavior(string unicode, bool containsInvalidHyphen)
{
var idnStd3False = new IdnMapping { UseStd3AsciiRules = false };
var idnStd3True = new IdnMapping { UseStd3AsciiRules = true };
if (containsInvalidHyphen && !s_isWindows)
{
// ICU always fails on leading/trailing hyphens regardless of the Std3 rules option.
Assert.Throws<ArgumentException>("unicode", () => idnStd3False.GetAscii(unicode));
}
else
{
Assert.Equal(unicode, idnStd3False.GetAscii(unicode));
}
ArgumentException ae = Assert.Throws<ArgumentException>(() => idnStd3True.GetAscii(unicode));
// sometimes the desktop returns "Unicode" instead of "unicode" for the parameter name.
Assert.Equal("unicode", ae.ParamName, ignoreCase: true);
}