private KoanResult combineContainersUnlessFailed(KoanResult state, KoanResult next) { if (state is Success) return combine(joinContainers, state.Message, next); else return state; }
private KoanResult combine(Func<string, string, string> joinMessages, string message, KoanResult next) { var newMsg = joinMessages(message, next.Message); if (next is Success) return new Success(newMsg); else return new Failure(newMsg, (next as Failure).Exception); }
private KoanResult combineLinesUnlessFailed(KoanResult state, KoanResult next) { if (state is Success) { return(combine(joinLines, state.Message, next)); } else { return(state); } }
private KoanResult combine(Func <string, string, string> joinMessages, string message, KoanResult next) { var newMsg = joinMessages(message, next.Message); if (next is Success) { return(new Success(newMsg)); } else { return(new Failure(newMsg, (next as Failure).Exception)); } }