Exemplo n.º 1
0
 private static void AppendCallList(IEnumerable <IFakeObjectCall> calls, CallWriter callWriter, IOutputWriter writer)
 {
     using (writer.Indent())
     {
         callWriter.WriteCalls(calls, writer);
     }
 }
Exemplo n.º 2
0
        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("...");
                }
            }
        }
Exemplo n.º 3
0
 private static void AppendCallList(IEnumerable<IFakeObjectCall> calls, CallWriter callWriter, IOutputWriter writer)
 {
     using (writer.Indent())
     {
         callWriter.WriteCalls(calls, writer);
     }
 }
Exemplo n.º 4
0
        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("...");
                }
            }
        }
Exemplo n.º 5
0
 private void AppendCallList(IOutputWriter writer)
 {
     using (writer.Indent())
     {
         this.callWriter.WriteCalls(this.Calls, writer);
     }
 }
Exemplo n.º 6
0
 private void AppendCallList(IOutputWriter writer)
 {
     using (writer.Indent())
     {
         this.callWriter.WriteCalls(this.Calls, writer);
     }
 }
Exemplo n.º 7
0
        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();
            }
        }
Exemplo n.º 8
0
 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();
     }
 }
Exemplo n.º 9
0
        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();
            }
        }
Exemplo n.º 10
0
        /// <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);
                }
            }
        }
Exemplo n.º 11
0
        /// <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);
                }
            }
        }
Exemplo n.º 12
0
        /// <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);
                }
            }
        }