Exemplo n.º 1
0
        public void TestWithDifferentTypeT()
        {
            var out0 = CompletesOutcomeT <Exception, string> .Of(ToString(1));

            var out1 = out0.AndThenTo(s => CompletesOutcomeT <Exception, float> .Of(ToFloat(s)));

            out1.Value.AndThenConsume(o => Assert.Equal(1F, (float)o.GetOrNull(), 0));
        }
Exemplo n.º 2
0
        public void TestWithTheSameTypeT()
        {
            var out0 = CompletesOutcomeT <Exception, int> .Of(AddsOne(1));

            var out1 = out0.AndThenTo(i => CompletesOutcomeT <Exception, int> .Of(AddsTwo(i)));

            out1.Value.AndThenConsume(o => Assert.Equal(4L, o.GetOrNull()));
        }
Exemplo n.º 3
0
 public void TestFailure()
 => CompletesOutcomeT <ArithmeticException, float> .Of(DivZero(42)).Value.AndThenConsume(o => Assert.True(o is Failure <ArithmeticException, float>));