Beispiel #1
0
        /// <summary>
        /// Displays a single line showing the types and sizes of the expected
        /// and actual collections or arrays. If both are identical, the value
        /// is only shown once.
        /// </summary>
        /// <param name="writer">The MessageWriter on which to display</param>
        /// <param name="expected">The expected collection or array</param>
        /// <param name="actual">The actual collection or array</param>
        /// <param name="indent">The indentation level for the message line</param>
        private static void DisplayCollectionTypesAndSizes(MessageWriter writer, ICollection expected, ICollection actual, int indent)
        {
            string sExpected = MsgUtils.GetTypeRepresentation(expected);

            if (!(expected is Array))
            {
                sExpected += string.Format(CultureInfo.CurrentCulture, Resources.WithElements_1, expected.Count);
            }

            string sActual = MsgUtils.GetTypeRepresentation(actual);

            if (!(actual is Array))
            {
                sActual += string.Format(CultureInfo.CurrentCulture, Resources.WithElements_1, expected.Count);
            }

            if (sExpected == sActual)
            {
                writer.WriteMessageLine(indent, Resources.CollectionType_1, sExpected);
            }
            else
            {
                writer.WriteMessageLine(indent, Resources.CollectionType_2, sExpected, sActual);
            }
        }