Beispiel #1
0
        public void SetHeightValue()
        {
            PrintDimension pd = new PrintDimension();

            pd.InternalPrintDefinition = new PrintDefinition();
            pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.All));

            pd.SetHeightValue(PrintAppendixes.Summary, 5);
            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(5));
            pd.SetHeightValue(PrintAppendixes.Summary, 6);
            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(6));
        }
        public void RecalculateHeightValueWhen([Random(10, 100, 1)] int initialHeight)
        {
            PrintDimension pd = new PrintDimension
            {
                InternalPrintDefinition = new PrintDefinition()
            };

            pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.All));

            Mock <IPrintProcessor> printProcessor = new Mock <IPrintProcessor>();

            printProcessor.Setup(i => i.GetSummary()).Returns(() => new Grid()
            {
                Height = initialHeight
            });
            pd.PrintProcessor = printProcessor.Object;

            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(initialHeight));
            pd.SetHeightValue(PrintAppendixes.Summary, 5);

            pd.RecalculateHeightValueWhen(() => false, PrintAppendixes.Summary);

            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(5));

            pd.RecalculateHeightValueWhen(() => true, PrintAppendixes.Summary);

            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(initialHeight));

            Assert.That(() => pd.RecalculateHeightValueWhen(null, PrintAppendixes.Summary), Throws.ArgumentNullException);
        }
        public void SetHeightValue()
        {
            PrintDimension pd = new PrintDimension
            {
                InternalPrintDefinition = new PrintDefinition()
            };

            pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.All));

            pd.SetHeightValue(PrintAppendixes.Summary, 5);
            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(5));
            pd.SetHeightValue(PrintAppendixes.Summary, 6);
            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(6));

            Assert.That(() => pd.SetHeightValue(PrintAppendixes.Summary, -1), Throws.TypeOf <ArgumentOutOfRangeException>());
        }
        public void RecalculateHeightValueWhen([Random(10, 100, 1)] int initialHeight)
        {
            PrintDimension pd = new PrintDimension();
            pd.InternalPrintDefinition = new PrintDefinition();
            pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.All));

            Mock<IPrintProcessor> printProcessor = new Mock<IPrintProcessor>();
            printProcessor.Setup(i => i.GetSummary()).Returns(() => new Grid() { Height = initialHeight });
            pd.PrintProcessor = printProcessor.Object;

            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(initialHeight));
            pd.SetHeightValue(PrintAppendixes.Summary, 5);

            pd.RecalculateHeightValueWhen(() => false, PrintAppendixes.Summary);

            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(5));

            pd.RecalculateHeightValueWhen(() => true, PrintAppendixes.Summary);

            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(initialHeight));
        }
        public void SetHeightValue()
        {
            PrintDimension pd = new PrintDimension();

            pd.InternalPrintDefinition = new PrintDefinition();
            pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.All));

            pd.SetHeightValue(PrintAppendixes.Summary, 5);
            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(5));
            pd.SetHeightValue(PrintAppendixes.Summary, 6);
            Assert.That(pd.GetHeightFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(6));
        }