Ejemplo n.º 1
0
        public void TestUpdateEditedData()
        {
            var updateInstance = new DepartmentMigration();

            updateInstance.UpdateEditedData();

            var departs      = new DepartInfoBll().QueryAll().ToList();
            var editedDepart = departs.Find(d => d.DepartmentName == "呼南运用车间");

            editedDepart.Should().NotBeNull();

            var dbUpdateLog = new DbUpdateLogBll().QueryList("TableName='DepartInfo' AND UpdateType=2");

            dbUpdateLog.Should().HaveCount(2);
        }
Ejemplo n.º 2
0
        public void TestImportNewData()
        {
            // 导入员工之前必须先导入部门、岗位
            var departImport = new DepartmentMigration();

            departImport.ImportNewData();

            var postImport = new PostMigragion();

            postImport.ImportNewData();

            var testInstance = new StaffMigration();

            testInstance.ImportNewData();

            var totalCount = 7063;
            var allStaff   = new PersonInfoBll().QueryAll().ToList();

            allStaff.Should().HaveCount(totalCount, $"because the total count of the data source is {totalCount}");

            var single = allStaff.Find(p => p.WorkNo == "2920133");

            single.Should().NotBeNull();
            single.Name.Should().Be("杨凤山");
            single.BirthDate.Should().Be(new DateTime(1960, 12, 1, 12, 0, 0));
            single.Password.Should().Be("0133".GetMd5());

            var dbLogs = new DbUpdateLogBll().QueryList($"TableName='{nameof(PersonInfo)}'");

            dbLogs.Should().HaveCount(totalCount);

            var relations = new PrimaryIdRelationBll().QueryAll();

            relations.Should().HaveCount(totalCount);

            var maxId = new OracleTableMaxIdBll().QuerySingle($"TableName='{nameof(Z_JCYY_BASEPERSONNEL)}'");

            maxId.Should().NotBeNull();
            maxId?.MaxId.Should().NotBeNullOrEmpty()
            .And.Subject.Should().Be("404990019");
        }
Ejemplo n.º 3
0
        public void TestImportNewData()
        {
            TestSuite.CleanTestDb();

            var importInstance = new DepartmentMigration();

            importInstance.ImportNewData();

            var departBll = new DepartInfoBll();
            var departs   = departBll.QueryAll().ToList();

            departs.Should().HaveCount(37, "because the table 'Y_JCYY_BASEDEPARTMENT' in oracle has 37 rows.");
            //departs.Should().Contain(depart => depart.DepartmentName == "集宁机务段");

            var jnDepot = departs.Find(d => d.DepartmentName == "集宁机务段");

            jnDepot.Should().NotBeNull();
            jnDepot?.DepartmentName.Should().NotBeNullOrEmpty().And.Be("集宁机务段");
            jnDepot?.ParentId.Should().Be(0);

            var jnyyc = departs.Find(d => d.DepartmentName == "集宁运用车间");

            jnyyc.Should().NotBeNull();
            jnyyc?.ParentId.Should().Be(jnDepot?.Id);

            var dbupdateLogBll = new DbUpdateLogBll();
            var dbupdateLogs   = dbupdateLogBll.QueryList($"TableName='{nameof(DepartInfo)}'").ToList();

            dbupdateLogs.Should().HaveCount(37);

            var relationBll = new PrimaryIdRelationBll();
            var relations   = relationBll.QueryAll().ToList();

            relations.Should().HaveCount(37);

            var maxBll     = new OracleTableMaxIdBll();
            var maxIdModel = maxBll.QuerySingle($"TableName='Y_JCYY_BASEDEPARTMENT'");

            maxIdModel.Should().NotBeNull();
            maxIdModel.MaxId.Should().Be("404100000");
        }