示例#1
0
        public void Create_Jobs_Base_and_QL()
        {
            //IJobRepository rep = _repFactory.GetDataRepository<IJobRepository>();
            IJarsJobRepository nhRep = _repFactory.GetDataRepository <IJarsJobRepository>();

            for (int i = 0; i < 100; i++)
            {
                JarsJob baseJob = new JarsJob
                {
                    StartDate   = DateTime.Now.Subtract(new TimeSpan(2, 0, 0)),
                    EndDate     = DateTime.Now,
                    Description = $"IJobBase Job {i}",
                    Location    = $" IJobBase from QL job {i}",
                    //AdditionalJobProperty = $"This {i}"
                };

                JarsJob jobQl = new JarsJob
                {
                    StartDate   = DateTime.Now.Subtract(new TimeSpan(2, 0, 0)),
                    EndDate     = DateTime.Now,
                    Description = $"QL Job {i}",
                    Location    = $"Test QL  {i}"
                };

                nhRep.CreateUpdate(baseJob, "DataCRUDTest");
                Assert.AreNotEqual(baseJob.Id, 0);

                nhRep.CreateUpdate(jobQl, "DataCRUDTest");
                Assert.AreNotEqual(jobQl.Id, 0);
            }
        }
示例#2
0
        public void Create_Resource_Jobs_Attachment_and_Lines()
        {
            IJarsJobRepository nhRep = _repFactory.GetDataRepository <IJarsJobRepository>();

            //create op
            for (int i = 0; i < 5; i++)
            {
                JarsResource res = new JarsResource
                {
                    DisplayName = $"Test{i}",
                    ExtRef1     = $"T00{i}",
                    IsActive    = true,
                    Skills      = new List <JarsResourceSkill> {
                        new JarsResourceSkill {
                            MaxLevel = 10, Description = "Test Skill", DocumentCode = $"SK0{i}T"
                        }
                    },
                    MobileNo = $"0{i}234{i}2312{i}"
                };

                //res = resrep.CreateUpdate(res, "TEST");

                JarsJobAttachment ja = new JarsJobAttachment {
                    Name = "Attach Test"
                };

                JarsJob baseJob = new JarsJob
                {
                    StartDate   = DateTime.Now.Subtract(new TimeSpan(2, 0, 0)),
                    EndDate     = DateTime.Now,
                    Description = $"IJob Job{i}",
                    Location    = $" IJob for Testing job {i}",
                    ExtRefId    = $"0{i}{i}{i}",
                    ResourceId  = res.Id
                };
                baseJob.Attachments.Add(ja);

                JarsJobLine line = new JarsJobLine {
                    Resource = res, LineCode = $"TEST0{i}", OriginalQty = 1, LineNum = 1, ExternalJobRef = baseJob.ExtRefId
                };

                baseJob.JobLines.Add(line);

                nhRep.CreateUpdate(baseJob, "TEST_LOOP");
            }
        }
示例#3
0
        void use_repository_factory_to_get_non_generic_repositories_and_create_record()
        {
            IJarsJobRepository jarsRep = _repFactory.GetDataRepository <IJarsJobRepository>();


            Assert.IsNotNull(jarsRep);
            //Assert.IsNotNull(qlRep);

            //test create
            JarsJob jj = jarsRep.CreateUpdate(new JarsJob(), "NONGEN_FACT_TEST");

            Assert.IsTrue(jj.Id > 0);


            //test read
            jj = jarsRep.GetById((long)1);
            Assert.IsTrue(jj.Id == 0);
        }