using System.Linq; using Centron.BusinessLogic; using Centron.BusinessLogic.WebServices.Sales.Receipts; using Centron.Tests.EndToEnd.Infrastructure; using CentronSoftware.Centron.WebServices.Entities.Sales.Receipts; using Xunit.Abstractions; namespace Centron.Tests.EndToEnd.Tests.Production { public class GetReceiptsWithProductionArticleTest : EndToEndTest { public GetReceiptsWithProductionArticleTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } public override void Execute() { this.PrepareDB(); this.LoadData(); } private void PrepareDB() { this.Sql("UPDATE dbo.ARTIK SET Fertigungsware = 1 WHERE I3D = 11"); this.Sql("UPDATE dbo.ARTIK SET Fertigungsware = 1 WHERE I3D = 22"); this.Sql("UPDATE dbo.ARTIK SET Fertigungsware = 1 WHERE I3D = 33"); this.Sql("UPDATE dbo.ARTIK SET Fertigungsware = 1 WHERE I3D = 44"); this.Sql("UPDATE dbo.ARTIK SET Fertigungsware = 1 WHERE I3D = 55"); this.Sql("UPDATE dbo.ARTIK SET Fertigungsware = 1 WHERE I3D = 66"); this.Sql("UPDATE dbo.ARTIK SET Fertigungsware = 1 WHERE I3D = 77"); } private void LoadData() { using (var session = new BLSession()) { var allReceipts = session.GetBL().GetOrdersWithProductionArticles(new OrderWithProductionArticlesFilter()); this.Verifier.Verify("allReceipts", allReceipts.Data.OrderBy(o => o.OrderI3D)); OrderWithProductionArticlesFilter filterOpenReceipt = new OrderWithProductionArticlesFilter() { IsActive = true, }; var openReceipts = session.GetBL().GetOrdersWithProductionArticles(filterOpenReceipt); this.Verifier.Verify("openReceipts", openReceipts); OrderWithProductionArticlesFilter filterArticle = new OrderWithProductionArticlesFilter() { ArticleI3Ds = new []{11,55} }; var articleReceipts = session.GetBL().GetOrdersWithProductionArticles(filterOpenReceipt); this.Verifier.Verify("articleReceipts", articleReceipts); } } } }