예제 #1
0
        public void GetHangingIndentPadding()
        {
            var    d0 = new LineMargins();
            string s1 = d0.GetHangingIndentPadding();

            Assert.Equal(d0.HangingIndent - 1, s1.Length);
        }
예제 #2
0
        public void GetLeftPaddingTest()
        {
            var    d0 = new LineMargins();
            string s1 = d0.GetLeftPadding();

            Assert.Equal(d0.LeftMargin, s1.Length + 1);
        }
예제 #3
0
        public void CtorStringTest()
        {
            string s0 = "(2,40,20)";
            string s1 = "(2,40)";
            var    d  = new LineMargins(s0);

            Assert.Equal(s0, d.ToString());
            Assert.Throws <ArgumentException>(() => new LineMargins(s1));
        }
예제 #4
0
        public void CtorTest()
        {
            var lm0 = new LineMargins("(2,60,20)");
            var ts0 = new TabStops("(4,10,30)");
            var d0  = new LineFormatter();
            var d1  = new LineFormatter(lm0);
            var d2  = new LineFormatter(lm0, ts0);

            Assert.Equal(new LineMargins(), d0.Margins);
            Assert.Equal(new TabStops(), d1.TabStops);
            Assert.Equal(lm0, d2.Margins);
            Assert.Equal(ts0, d2.TabStops);
        }
예제 #5
0
        public void EqualsTest()
        {
            var         lm0 = new LineMargins("(2,20,10)");
            var         lm1 = new LineMargins("(2,20,11)");
            var         lm2 = new LineMargins("(2,20,10)");
            LineMargins lm3 = null;

            Assert.True(lm0 == lm2);
            Assert.True(lm0 != lm1);
            Assert.False(lm0 == lm3);
            Assert.False(lm3 == lm0);
            Assert.True(lm0 != lm3);
            Assert.True(lm3 != lm0);
        }
예제 #6
0
        public void CtorTest()
        {
            int l0  = 5;
            int r0  = 100;
            int hi0 = 20;
            var d0  = new LineMargins(l0, r0, hi0);

            Assert.Equal(l0, d0.LeftMargin);
            Assert.Equal(r0, d0.RightMargin);
            Assert.Equal(hi0, d0.HangingIndent);
            Assert.ThrowsAny <Exception>(() => new LineMargins(-1, 100, 10));
            Assert.ThrowsAny <Exception>(() => new LineMargins(1, 1, 10));
            Assert.ThrowsAny <Exception>(() => new LineMargins(1, 100, 100));
        }