Ejemplo n.º 1
0
 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());
        }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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());
        }
Ejemplo n.º 6
0
        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());
        }
Ejemplo n.º 7
0
        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();
        }
Ejemplo n.º 8
0
 public void WriteFailingCallsDescriptions(StringBuilderOutputWriter builder)
 {
     using (builder.Indent())
     {
         foreach (var call in this.unguardedCalls)
         {
             call.WriteFailingCallDescription(builder);
             builder.WriteLine();
         }
     }
 }