Esempio n. 1
0
        public void Create_JarsJobs_Service()
        {
            var client = CreateClient();

            JarsJob jj = new JarsJob {
                Description = $"Test Jars Job 0", Location = $"Test Location JarsJob 0", ExtRefId = "0", StatusKey = "0", LabelKey = "0", CreatedBy = $"TEST 0"
            };

            jj.JobLines.Add(new JarsJobLine {
                ShortDescription = $"Test JarsJobLine on Job 0", LineNum = 1, LineCode = "CODE0", OriginalQty = 0
            });

            List <JarsJob> jjl = new List <JarsJob>();

            for (int i = 1; i <= 5; i++)
            {
                JarsJob jji = new JarsJob {
                    Description = $"Test Jars Job {i}", Location = $"Test Location JarsJob {i}", ExtRefId = i.ToString(), StatusKey = $"{i}", LabelKey = $"{i}", CreatedBy = $"TEST {i}"
                };
                jji.JobLines.Add(new JarsJobLine {
                    ShortDescription = $"Test JarsJobLine on Job {i}", LineNum = 1, LineCode = "CODE1", OriginalQty = i
                });
                jjl.Add(jji);
            }
            //store only takes Full jobs
            var rs = client.Post(new StoreJobs {
                Jobs = new List <JarsJobDto>(new[] { jj.ConvertTo <JarsJobDto>() })
            });

            Assert.IsTrue(rs.Jobs[0].Id > 0);

            rs = client.Post(new StoreJobs {
                Jobs = jjl.ConvertAllTo <JarsJobDto>().ToList()
            });
            Assert.IsTrue(rs.Jobs.Count > 0);

            var rg = client.Get(new GetJarsJob {
                Id = 1
            });

            Assert.IsTrue(rg.Jobs != null);

            rg = client.Get(new GetJarsJob {
                Id = 1
            });
            Assert.IsTrue(rg.Jobs != null);
        }
Esempio n. 2
0
        public void Convert_To_Test()
        {
            //see if all properties are changed
            simpleJob sj = new simpleJob();

            sj.ActualStartDate = DateTime.Now.AddDays(-0.5);
            sj.ActualEndDate   = DateTime.Now.AddDays(-1);
            //see if only passes properties are changed
            JarsJob job = FakeDataHelper.FakeJarsJobs[0];

            job.LabelKey  = "6";
            job.StatusKey = "6";

            sj = job.ConvertTo(sj);

            Assert.IsTrue(job.ActualStartDate == sj.ActualStartDate);
        }