public void Convert_ForSuccessResult() { ParseResult <int> original = ParseResult <int> .ForValue(10); ParseResult <string> converted = original.Convert(x => $"xx{x}xx"); Assert.AreEqual("xx10xx", converted.Value); }
public void Convert_ForFailureResult() { ParseResult <int> original = ParseResult <int> .ForInvalidValue("text"); ParseResult <string> converted = original.Convert(x => "xx" + x + "xx"); Assert.Throws <UnparsableValueException>(() => converted.GetValueOrThrow()); }
public void Convert_ForFailureResult() { ParseResult <string> converted = FailureResult.Convert(x => $"xx{x}xx"); Assert.Throws <UnparsableValueException>(() => converted.GetValueOrThrow()); }