コード例 #1
0
        public void IsToPrint_CheckLastPage()
        {
            var pd = new PrintDefinition();
            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, true), Is.False);

            pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, PrintPartDefinitionAttribute.LastPage));

            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, true), Is.True);
        }
コード例 #2
0
        public void IsToPrint_IncludePage()
        {
            var pd = new PrintDefinition();
            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False);

            pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, 2));

            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False);
            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.True);
        }
コード例 #3
0
        public void IsToPrint_CheckSinglePage()
        {
            var pd = new PrintDefinition();

            pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, PrintPartDefinitionAttribute.LastPage));

            // do not print on page #1
            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False);

            // but print on last page
            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, true), Is.True);
        }
コード例 #4
0
 public void IsToPrint_InvalidArgumentException()
 {
     var pd = new PrintDefinition();
     Assert.That(() => pd.IsToPrint((PrintAppendixes)(-1), 1, false), Throws.ArgumentException);
 }
コード例 #5
0
        public void SetPrintAttribute_Null_ThrowsException()
        {
            var pd = new PrintDefinition();

            Assert.That(() => pd.SetPrintAttribute(null), Throws.ArgumentNullException);
        }
コード例 #6
0
        public void SetPrintAttribute()
        {
            var pd = new PrintDefinition();

            pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, 1));

            Assert.That(pd.IsDefined(PrintAppendixes.Footer), Is.True);
        }
コード例 #7
0
 public void IsToPrint_NegativePage_ThrowsException()
 {
     var pd = new PrintDefinition();
     pd.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.Footer));
     Assert.That(() => pd.IsToPrint(PrintAppendixes.Footer, -1, false), Throws.InstanceOf<ArgumentOutOfRangeException>());
 }