public void ConvertToEFailable_None()
        {
            var maybe = Maybe <string> .None;
            EFailable <string> failable = maybe.ToEFailable(new ArgumentException("msg"));

            Assert.That(failable.IsFailure, Is.True);
            Assert.That(failable.FailureOrThrow().Message, Is.EqualTo("msg"));
        }
Exemple #2
0
        public void ConvertToEFailable_Failure()
        {
            var failable = Failable <string, bool> .Failure(true);

            EFailable <string> EFailable = failable.ToEFailable(new ArgumentException("msg"));

            Assert.That(EFailable.IsFailure, Is.True);
            Assert.That(EFailable.FailureOrThrow().Message, Is.EqualTo("msg"));
        }
        public void OrConvertToEFailable_Failure()
        {
            var option = Option <int, string> .Failure("notMsg");

            EFailable <int> failable = option.OrToEFailable(456, new ArgumentException("msg"));

            Assert.That(failable.IsFailure, Is.True);
            Assert.That(failable.FailureOrThrow().Message, Is.EqualTo("msg"));
        }
        public void ConvertToEFailable_Failure()
        {
            var EOption = EOption <string> .Failure(new ArgumentException( "msg" ));

            EFailable <string> failable = EOption.ToEFailable(new ArgumentException("to-be-used-on-none!"));

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