public void FunctionMatchingOverloadInvokesTheErrorBranchWithTheProvidedErrorValue() { var result = Result.Error(new PinkLily()); var matchValue = new VioletIris(); var matchError = new VioletIris(); var matchResult = result.Match( () => matchValue, e => matchError); Assert.AreEqual(matchError, matchResult); }
public void FunctionMatchingOverloadInvokesTheSuccessBranch() { var successDummy = new VioletIris(); var errorDummy = new VioletIris(); var result = Result.Success <RedDragon, string>(new RedDragon()); var matchResult = result.Match( v => successDummy, e => errorDummy); Assert.AreEqual(successDummy, matchResult); Assert.AreNotSame(errorDummy, matchResult); }
public void ActionMatchingOverloadInvokesTheErrorBranchWithTheProvidedErrorValue() { var result = Result.Error(new PinkLily()); var spy = new Spy(); var matchValue = new VioletIris(); var matchError = new VioletIris(); result.Match( () => { spy.Trip(matchValue); }, e => { spy.Trip(matchError); } ); spy.VerifyTrip(1, matchError); }