private static void AppendCallList(IEnumerable <IFakeObjectCall> calls, CallWriter callWriter, IOutputWriter writer) { using (writer.Indent()) { callWriter.WriteCalls(calls, writer); } }
private static void WriteCalls(IEnumerable<CallInfo> callInfos, IOutputWriter writer) { var lastCall = callInfos.Last(); var numberOfDigitsInLastCallNumber = lastCall.NumberOfDigitsInCallNumber(); foreach (var call in callInfos) { if (call.CallNumber > 1) { writer.WriteLine(); } writer.Write(call.CallNumber); writer.Write(": "); WriteSpaces(writer, numberOfDigitsInLastCallNumber - call.NumberOfDigitsInCallNumber()); using (writer.Indent()) { writer.Write(call.StringRepresentation); } if (call.Repeat > 1) { writer.Write(" repeated "); writer.Write(call.Repeat); writer.Write(" times"); writer.WriteLine(); writer.Write("..."); } } }
private static void AppendCallList(IEnumerable<IFakeObjectCall> calls, CallWriter callWriter, IOutputWriter writer) { using (writer.Indent()) { callWriter.WriteCalls(calls, writer); } }
private static void WriteCalls(IEnumerable <CallInfo> callInfos, IOutputWriter writer) { var lastCall = callInfos.Last(); var numberOfDigitsInLastCallNumber = lastCall.NumberOfDigitsInCallNumber(); foreach (var call in callInfos) { if (call.CallNumber > 1) { writer.WriteLine(); } writer.Write(call.CallNumber); writer.Write(": "); WriteSpaces(writer, numberOfDigitsInLastCallNumber - call.NumberOfDigitsInCallNumber()); using (writer.Indent()) { writer.Write(call.StringRepresentation); } if (call.Repeat > 1) { writer.Write(" repeated "); writer.Write(call.Repeat); writer.Write(" times"); writer.WriteLine(); writer.Write("..."); } } }
private void AppendCallList(IOutputWriter writer) { using (writer.Indent()) { this.callWriter.WriteCalls(this.Calls, writer); } }
private static void AppendCallDescription(string callDescription, IOutputWriter writer) { writer.WriteLine(); writer.Write("Assertion failed for the following call:"); writer.WriteLine(); using (writer.Indent()) { writer.Write(callDescription); writer.WriteLine(); } }
private static void Write(IOutputWriter writer, Exception ex, string message) { writer.Write(message); writer.WriteLine(); using (writer.Indent()) { writer.Write(ex.GetType()); writer.Write(": "); writer.Write(ex.Message); writer.WriteLine(); } }
/// <summary> /// Writes a description of calls the rule is applicable to. /// </summary> /// <param name="writer">The writer to write the description to.</param> public void WriteDescriptionOfValidCall(IOutputWriter writer) { writer.Write(this.DescriptionOfValidCall); Func <string> wherePrefix = () => { wherePrefix = () => "and"; return("where"); }; using (writer.Indent()) { foreach (var wherePredicateDescriptionWriter in this.wherePredicates.Select(x => x.Item2)) { writer.WriteLine(); writer.Write(wherePrefix.Invoke()); writer.Write(" "); wherePredicateDescriptionWriter.Invoke(writer); } } }
/// <summary> /// Writes a description of calls the rule is applicable to. /// </summary> /// <param name="writer">The writer to write the description to.</param> public void WriteDescriptionOfValidCall(IOutputWriter writer) { Guard.AgainstNull(writer, nameof(writer)); this.DescribeCallOn(writer); Func <string> wherePrefix = () => { wherePrefix = () => "and"; return("where"); }; using (writer.Indent()) { foreach (var wherePredicate in this.wherePredicates) { writer.WriteLine(); writer.Write(wherePrefix.Invoke()); writer.Write(" "); wherePredicate.WriteDescription(writer); } } }
/// <summary> /// Writes a description of calls the rule is applicable to. /// </summary> /// <param name="writer">The writer to write the description to.</param> public void WriteDescriptionOfValidCall(IOutputWriter writer) { writer.Write(this.DescriptionOfValidCall); Func<string> wherePrefix = () => { wherePrefix = () => "and"; return "where"; }; using (writer.Indent()) { foreach (var wherePredicateDescriptionWriter in this.wherePredicates.Select(x => x.Item2)) { writer.WriteLine(); writer.Write(wherePrefix.Invoke()); writer.Write(" "); wherePredicateDescriptionWriter.Invoke(writer); } } }