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)); }
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())); }
public void TestFailure() => CompletesOutcomeT <ArithmeticException, float> .Of(DivZero(42)).Value.AndThenConsume(o => Assert.True(o is Failure <ArithmeticException, float>));