示例#1
0
        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());
        }
示例#3
0
        public void Convert_ForFailureResult()
        {
            ParseResult <string> converted = FailureResult.Convert(x => $"xx{x}xx");

            Assert.Throws <UnparsableValueException>(() => converted.GetValueOrThrow());
        }