public void Should_parse_Decimal() { foreach (var expectedValue in new[] { 0M, 123M, 5123M, 51.23M }) { var sequence = expectedValue.ToString().ToReadOnlySequence(); var worked = PipeParser.TryParsePositiveDecimal(sequence, out var parsedValue); Assert.True(worked); Assert.Equal(expectedValue, parsedValue); } }
public void Should_not_parse_When_negative_or_letter(string value) { var sequence = value.ToReadOnlySequence(); var worked = PipeParser.TryParsePositiveDecimal(sequence, out var _); Assert.False(worked); worked = PipeParser.TryParsePositiveLong(sequence, out var _); Assert.False(worked); worked = PipeParser.TryParsePositiveInteger(sequence, out var _); Assert.False(worked); }