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);
        }
        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);
        }
        public void IsToPrint_ExcludePage()
        {
            var pd = new PrintDefinition();
            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.False);

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

            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.False);

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

            Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.False);
        }
 public void IsToPrint_InvalidArgumentException()
 {
     var pd = new PrintDefinition();
     Assert.That(() => pd.IsToPrint((PrintAppendixes)(-1), 1, false), Throws.ArgumentException);
 }
 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>());
 }