public void DisplayListElementsTest(string label, IList list, int index, int max, string result)
        {
            AssertionFailureMessage afm = new AssertionFailureMessage();

            afm.DisplayListElements(label, list, index, max);
            Assert.AreEqual(result, afm.ToString());
        }
            public void DisplayListElements()
            {
                AssertionFailureMessage msg = null;

                msg = new AssertionFailureMessage("message");
                msg.DisplayListElements("label:", new object[] { "a", "b", "c" }, 0, 3);
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<<\"a\">,<\"b\">,<\"c\">>" + Environment.NewLine,
                    msg.ToString());

                msg = new AssertionFailureMessage("message");
                msg.DisplayListElements("label:", new object[] { "a", "b", "c" }, 0, 5);
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<<\"a\">,<\"b\">,<\"c\">>" + Environment.NewLine,
                    msg.ToString());

                msg = new AssertionFailureMessage("message");
                msg.DisplayListElements("label:", new object[] { "a", "b", "c" }, 1, 1);
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<<\"b\">,...>" + Environment.NewLine,
                    msg.ToString());

                msg = new AssertionFailureMessage("message");
                msg.DisplayListElements("label:", new object[] { "a", "b", "c" }, 1, 5);
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<<\"b\">,<\"c\">>" + Environment.NewLine,
                    msg.ToString());

                msg = new AssertionFailureMessage("message");
                msg.DisplayListElements("label:", new object[0], 0, 5);
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<empty>" + Environment.NewLine,
                    msg.ToString());


                msg = new AssertionFailureMessage("message");
                msg.DisplayListElements("label:", null, 0, 5);
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<null>" + Environment.NewLine,
                    msg.ToString());
            }
Esempio n. 3
0
            public void DisplayListElements()
            {
                AssertionFailureMessage msg = null;

                msg = new AssertionFailureMessage( "message");
                msg.DisplayListElements( "label:", new object[] { "a", "b", "c" }, 0, 3 );
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<<\"a\">,<\"b\">,<\"c\">>" + Environment.NewLine,
                    msg.ToString() );

                msg = new AssertionFailureMessage( "message");
                msg.DisplayListElements( "label:", new object[] { "a", "b", "c" }, 0, 5 );
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<<\"a\">,<\"b\">,<\"c\">>" + Environment.NewLine,
                    msg.ToString() );

                msg = new AssertionFailureMessage( "message");
                msg.DisplayListElements( "label:", new object[] { "a", "b", "c" }, 1, 1 );
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<<\"b\">,...>" + Environment.NewLine,
                    msg.ToString() );

                msg = new AssertionFailureMessage( "message");
                msg.DisplayListElements( "label:", new object[] { "a", "b", "c" }, 1, 5 );
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<<\"b\">,<\"c\">>" + Environment.NewLine,
                    msg.ToString() );

                msg = new AssertionFailureMessage( "message");
                msg.DisplayListElements( "label:", new object[0], 0, 5 );
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<empty>" + Environment.NewLine,
                    msg.ToString() );

                msg = new AssertionFailureMessage( "message");
                msg.DisplayListElements( "label:", null, 0, 5 );
                Assert.AreEqual(
                    "message" + System.Environment.NewLine +
                    "label:<null>" + Environment.NewLine,
                    msg.ToString() );
            }