public void Int32TryParse() { ReadOnlySpan <char> span = int.MaxValue.ToString().AsSpan(); Assert.True(Int32Polyfill.TryParse(span, out int value)); Assert.Equal(int.MaxValue, value); }
public void Int32TryParseCulture() { var culture = CultureInfo.CreateSpecificCulture("pl-PL"); var formatted = (" " + int.MaxValue.ToString("N", culture)); Assert.True(Int32Polyfill.TryParse(formatted.AsSpan(), NumberStyles.AllowLeadingWhite | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, culture, out int value)); Assert.Equal(int.MaxValue, value); }