/// <summary> /// <para>Attempts to parse <see cref="DataRate"/> from a string.</para> /// <para>In case of failure a <see cref="FormatException"/> is thrown.</para> /// </summary> public static DataRate Parse(string input) => DataRateParser.Parse(input);
public void Should_throw_FormatException_on_Parse_wrong_format() { new Action(() => DataRateParser.Parse(@"10 \s")).Should().Throw <FormatException>(); }
/// <summary> /// Attempts to parse <see cref="DataRate"/> from a string. /// </summary> public static bool TryParse(string input, out DataRate result) => DataRateParser.TryParse(input, out result);
public void Should_TryParse(string input, bool boolRes, int seconds) { DataRateParser.TryParse(input, out var res).Should() .Be(boolRes && res.BytesPerSecond == seconds); }