public void GetRangeFor() { Mock <IPrintProcessor> mock = new Mock <IPrintProcessor>(); mock.Setup(i => i.GetHeader()).Returns(new Grid { Height = 10 }); mock.Setup(i => i.GetFooter()).Returns(new Grid { Height = 20 }); mock.Setup(i => i.GetHeaderDescription()).Returns(new Grid { Height = 30 }); mock.Setup(i => i.GetSummary()).Returns(new Grid { Height = 40 }); PrintDimension pd = new PrintDimension(); pd.PrintProcessor = mock.Object; pd.Margin = new Thickness(10); pd.PageSize = new Size(100, 1000); pd.InternalPrintDefinition = new PrintDefinition(); pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.All)); Assert.That(pd.GetRangeFor(PrintAppendixes.Header, 1, false), Is.EqualTo(new Range <double>(10, 20))); Assert.That(pd.GetRangeFor(PrintAppendixes.HeaderDescription, 1, false), Is.EqualTo(new Range <double>(20, 50))); Assert.That(pd.GetRangeForBodyGrid(1, false), Is.EqualTo(new Range <double>(50, 905))); Assert.That(pd.GetRangeFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(new Range <double>(905, 945))); Assert.That(pd.GetRangeFor(PrintAppendixes.Footer, 1, false), Is.EqualTo(new Range <double>(945, 965))); Assert.That(pd.GetRangeFor(PrintAppendixes.PageNumbers, 1, false), Is.EqualTo(new Range <double>(965, 990))); }
public void GetRangeFor_InvalidPrintAppendix() { PrintDimension pd = new PrintDimension(); Assert.That(() => pd.GetRangeFor(PrintAppendixes.All, 1, false), Throws.ArgumentException); }
public void GetRangeFor() { Mock<IPrintProcessor> mock = new Mock<IPrintProcessor>(); mock.Setup(i => i.GetHeader()).Returns(new Grid { Height = 10 }); mock.Setup(i => i.GetFooter()).Returns(new Grid { Height = 20 }); mock.Setup(i => i.GetHeaderDescription()).Returns(new Grid { Height = 30 }); mock.Setup(i => i.GetSummary()).Returns(new Grid { Height = 40 }); PrintDimension pd = new PrintDimension(); pd.PrintProcessor = mock.Object; pd.Margin = new Thickness(10); pd.PageSize = new Size(100, 1000); pd.InternalPrintDefinition = new PrintDefinition(); pd.InternalPrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.All)); Assert.That(pd.GetRangeFor(PrintAppendixes.Header, 1, false), Is.EqualTo(new Range<double>(10, 20))); Assert.That(pd.GetRangeFor(PrintAppendixes.HeaderDescription, 1, false), Is.EqualTo(new Range<double>(20, 50))); Assert.That(pd.GetRangeForBodyGrid(1, false), Is.EqualTo(new Range<double>(50, 905))); Assert.That(pd.GetRangeFor(PrintAppendixes.Summary, 1, false), Is.EqualTo(new Range<double>(905, 945))); Assert.That(pd.GetRangeFor(PrintAppendixes.Footer, 1, false), Is.EqualTo(new Range<double>(945, 965))); Assert.That(pd.GetRangeFor(PrintAppendixes.PageNumbers, 1, false), Is.EqualTo(new Range<double>(965, 990))); }