private static string CreateExceptionMessage( IEnumerable<IFakeObjectCall> calls, CallWriter callWriter, string callDescription, string repeatDescription, int matchedCallCount) { var writer = new StringBuilderOutputWriter(); writer.WriteLine(); using (writer.Indent()) { AppendCallDescription(callDescription, writer); AppendExpectation(calls, repeatDescription, matchedCallCount, writer); AppendCallList(calls, callWriter, writer); writer.WriteLine(); } return writer.Builder.ToString(); }
private void WriteActualValueTo(StringBuilderOutputWriter builder) { builder.Write( "When called with the following arguments the method did not throw the appropriate exception:"); builder.WriteLine(); this.state.WriteFailingCallsDescriptions(builder); }
private string CreateExceptionMessage(string callDescription, string repeatDescription, int repeat) { var outputWriter = new StringBuilderOutputWriter(); outputWriter.WriteLine(); using (outputWriter.Indent()) { AppendCallDescription(callDescription, outputWriter); this.AppendExpectation(repeatDescription, repeat, outputWriter); this.AppendCallList(outputWriter); outputWriter.WriteLine(); } return(outputWriter.Builder.ToString()); }
private static string CreateExceptionMessage( IEnumerable <IFakeObjectCall> calls, CallWriter callWriter, string callDescription, string repeatDescription, int matchedCallCount) { var writer = new StringBuilderOutputWriter(); writer.WriteLine(); using (writer.Indent()) { AppendCallDescription(callDescription, writer); AppendExpectation(calls, repeatDescription, matchedCallCount, writer); AppendCallList(calls, callWriter, writer); writer.WriteLine(); } return(writer.Builder.ToString()); }
public void WriteFailingCallsDescriptions(StringBuilderOutputWriter builder) { using (builder.Indent()) { foreach (var call in this.unguardedCalls) { call.WriteFailingCallDescription(builder); builder.WriteLine(); } } }
private static void ThrowExceptionWhenAssertionFailed( List<AssertedCall> assertedCalls, CallWriter callWriter, IEnumerable<IFakeObjectCall> originalCallList) { var message = new StringBuilderOutputWriter(); message.WriteLine(); message.WriteLine(); using (message.Indent()) { message.Write("Assertion failed for the following calls:"); message.WriteLine(); using (message.Indent()) { foreach (var call in assertedCalls) { message.Write("'"); message.Write(call.CallDescription); message.Write("' "); message.Write("repeated "); message.Write(call.RepeatDescription); message.WriteLine(); } } message.Write("The calls where found but not in the correct order among the calls:"); message.WriteLine(); using (message.Indent()) { callWriter.WriteCalls(originalCallList, message); } } throw new ExpectationException(message.Builder.ToString()); }
private static void ThrowExceptionWhenAssertionFailed( List <AssertedCall> assertedCalls, CallWriter callWriter, List <ICompletedFakeObjectCall> originalCallList) { var message = new StringBuilderOutputWriter(); message.WriteLine(); message.WriteLine(); using (message.Indent()) { message.Write("Assertion failed for the following calls:"); message.WriteLine(); using (message.Indent()) { foreach (var call in assertedCalls) { message.Write("'"); message.Write(call.CallDescription); message.Write("' "); message.Write("repeated "); message.Write(call.RepeatDescription); message.WriteLine(); } } message.Write("The calls where found but not in the correct order among the calls:"); message.WriteLine(); using (message.Indent()) { callWriter.WriteCalls(originalCallList, message); } } throw new ExpectationException(message.Builder.ToString()); }
public void BeNullGuarded() { var matches = this.Matches(this.call); if (matches) { return; } var builder = new StringBuilderOutputWriter(); this.WriteDescriptionTo(builder); builder.WriteLine(); this.WriteActualValueTo(builder); var reason = builder.Builder.ToString(); Execute.Assertion.FailWith(reason); }
private string CreateExceptionMessage(string callDescription, string repeatDescription, int repeat) { var outputWriter = new StringBuilderOutputWriter(); outputWriter.WriteLine(); using (outputWriter.Indent()) { AppendCallDescription(callDescription, outputWriter); this.AppendExpectation(repeatDescription, repeat, outputWriter); this.AppendCallList(outputWriter); outputWriter.WriteLine(); } return outputWriter.Builder.ToString(); }