using System.Collections.Generic; using Centron.BusinessLogic; using Centron.BusinessLogic.WebServices.Sales.Receipts; using Centron.BusinessLogic.WebServices.Warehousing; using Centron.BusinessLogic.WebServices.Warehousing.ArticleProduction; using Centron.Tests.EndToEnd.Infrastructure; using CentronSoftware.Centron.WebServices.Entities.Sales.Receipts; using CentronSoftware.Centron.WebServices.Entities.Warehousing; using Xunit.Abstractions; namespace Centron.Tests.EndToEnd.Tests.Production { public class ArticleProductionTest : EndToEndTest { public ArticleProductionTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } public override void Execute() { this.PrepareDB(); this.CreateArticleProductionMaterials(); this.GetArticleProductionMaterials(); } 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 CreateArticleProductionMaterials() { using (var session = new BLSession()) { var article1 = session.GetBL().GetArticlePreviewByArticleI3D(3328); var article2 = session.GetBL().GetArticlePreviewByArticleI3D(1314); var article3 = session.GetBL().GetArticlePreviewByArticleI3D(4340); var article4 = session.GetBL().GetArticlePreviewByArticleI3D(4362); var articleProductionMaterial1 = new ArticleProductionMaterialDTO { ProducedArticleI3D = 11, MaterialArticle = article1, Comment = "For a long time it puzzled me how something so expensive, so leading edge, could be so useless,", Quantity = 1 }; var articleProductionMaterial2 = new ArticleProductionMaterialDTO { ProducedArticleI3D = 22, MaterialArticle = article2, Comment = "and then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things,", Quantity = 2 }; var articleProductionMaterial3 = new ArticleProductionMaterialDTO { ProducedArticleI3D = 33, MaterialArticle = article3, Comment = "while computer programmers are smart people with the ability to do incredibly stupid things.", Quantity = 3 }; var articleProductionMaterial14 = new ArticleProductionMaterialDTO { ProducedArticleI3D = 44, MaterialArticle = article4, Comment = "They are, in short, a perfect match. Bill Bryson", Quantity = 4 }; var list = new List() { articleProductionMaterial1, articleProductionMaterial2 , articleProductionMaterial3, articleProductionMaterial14 }; session.GetBL().SaveOrUpdateArticleProductionMaterials(list); } } private void GetArticleProductionMaterials() { using (var session = new BLSession()) { var allProductionArticles = session.GetBL().GetArticleProductionMaterialsByFilter(new ArticleProductionMaterialFilter()); this.Verifier.Verify("allProductionArticles", allProductionArticles); var billsProductionArticles = session.GetBL().GetArticleProductionMaterialsByFilter(new ArticleProductionMaterialFilter(){CommentSearchText = "Bill"}); this.Verifier.Verify("BillsProductionArticles", billsProductionArticles); var parentProductionArticles = session.GetBL().GetArticleProductionMaterialsByFilter(new ArticleProductionMaterialFilter(){ProducedArticleI3D = 33}); this.Verifier.Verify("parentProductionArticles", parentProductionArticles); } } } }