示例#1
0
        public void MapFailureToDifferentType()
        {
            var one = Failable <bool, int> .Failure(1);

            Failable <bool, string> onePlusOne = one.MapFailure(i => $"{i}+1=2");

            Assert.That(onePlusOne.FailureOrThrow(), Is.EqualTo("1+1=2"));
        }
示例#2
0
        public void ConvertToFailable_None()
        {
            var maybe = Maybe <string> .None;
            Failable <string, ArgumentException> failable = maybe.ToFailable(new ArgumentException("msg"));

            Assert.That(failable.IsFailure, Is.True);
            Assert.That(failable.FailureOrThrow().Message, Is.EqualTo("msg"));
        }