public void GivenSalesOrderPrintDocument_WhenPrinting_ThenMediaCreated() { // Arrange var demo = new Demo(this.Session, null); demo.Execute(); this.Session.Derive(true); var order = new SalesOrders(this.Session).Extent().First; // Act order.Print(); this.Session.Derive(); this.Session.Commit(); // Assert Assert.True(order.PrintDocument.ExistMedia); var desktopDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); var outputFile = System.IO.File.Create(System.IO.Path.Combine(desktopDir, "salesOrder.odt")); var stream = new System.IO.MemoryStream(order.PrintDocument.Media.MediaContent.Data); stream.CopyTo(outputFile); stream.Close(); }
public void GivenSalesOrder_WhenDeriving_henPrintDocumentWithoutMediaCreated() { // Arrange var demo = new Demo(this.Session, null); demo.Execute(); // Act this.Session.Derive(true); // Assert var order = new SalesOrders(this.Session).Extent().First; Assert.True(order.ExistPrintDocument); Assert.False(order.PrintDocument.ExistMedia); }
public void GivenSalesOrder_WhenCreatingPrintModel_ThenPrintModelIsNotNull() { // Arrange var demo = new Demo(this.Session, null); demo.Execute(); this.Session.Derive(true); var order = new SalesOrders(this.Session).Extent().First; // Act var printModel = new Print.SalesOrderModel.Model(order); // Assert Assert.NotNull(printModel); }