Exemplo n.º 1
0
        public void TestInvalidTextEl()
        {
            TestTheText ttt = new TestTheText("Bonjour");

            Assert.ThrowsException <ArgumentNullException>(() => _ = new TextElTest());
            Assert.ThrowsException <ArgumentNullException>(() => _ = new TextEl(null, 17, 18));
            Assert.ThrowsException <ArgumentException>(() => _     = new TextEl(ttt, 17, 18));
            Assert.ThrowsException <ArgumentException>(() => _     = new TextEl(ttt, -10, 18));
            Assert.ThrowsException <ArgumentException>(() => _     = new TextEl(ttt, -10, -2));

            ttt = new TestTheText("");
            Assert.ThrowsException <ArgumentException>(() => _ = new TextEl(ttt, 0, 0));
        }
Exemplo n.º 2
0
        public void TestSetCharFormat()
        {
            string     s   = @"Heureux qui, comme Ulysse, a fait un beau voyage,
                        Ou comme cestuy la qui conquit la toison,
                        Et puis est retourné, plein d'usage et raison,
                        Vivre entre ses parents le reste de son age!";
            TheText    tt  = new TheText(s);
            TextElTest tet = new TextElTest(tt, 19, 24); // Ulysse

            Assert.AreEqual("Ulysse", tet.ToString());

            tet.TestEstConsonne(); // comme ça c'est fait aussi...
        }