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 Int32ParseCulture() { var culture = CultureInfo.CreateSpecificCulture("pl-PL"); var formatted = (" " + int.MaxValue.ToString("N", culture)); var value = Int32Polyfill.Parse(formatted.AsSpan(), NumberStyles.AllowLeadingWhite | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, culture); Assert.Equal(int.MaxValue, value); }