Пример #1
0
        public static void ChangePaperTemplateStatus(object source, ElapsedEventArgs e)
        {
            ChangePaperTemplateStatus cpts;
            ResponseJson resJson;

            cpts = new ChangePaperTemplateStatus();
            resJson = cpts.Change();
        }
Пример #2
0
        public static void ChangePaperTemplateStatus(object source, ElapsedEventArgs e)
        {
            ChangePaperTemplateStatus cpts;
            ResponseJson resJson;

            cpts    = new ChangePaperTemplateStatus();
            resJson = cpts.Change();
        }
        public void ChangeTest1()
        {
            int id;
            DateTime now, startTime;
            ExaminationTask et;
            ExaminationPaperTemplate ept;
            UExaminationTask uet;
            GeneratePaperTemplate_Accessor gpt = new GeneratePaperTemplate_Accessor();
            ChangePaperTemplateStatus target;
            ResponseJson resJson;
            Object expected, actual;

            // 获取状态为“未做”、“进行中”的试卷模板
            #region 部署测试数据

            now = DateTime.Now;
            uet = new UExaminationTask();

            startTime = new DateTime(1970, 1, 1, now.AddHours(1).Hour, now.Minute, 0);
            id = new Utility().GetETId();
            et = new ExaminationTask
            {
                ET_Id = id,
                ET_Name = "单元测试每日任务" + id,
                ET_Enabled = (Byte)ExaminationTaskStatus.Enabled,
                ET_Type = (Byte)ExaminationTaskType.Examination,
                ET_ParticipatingDepartment = "[6,9]",
                ET_Attendee = "[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,39,40,41,42,43,44,45]",
                ET_StatisticType = (Byte)StatisticType.Score,
                ET_TotalScore = 100,
                ET_TotalNumber = 10,
                ET_Mode = (Byte)ExaminationTaskMode.Auto,
                ET_AutoType = (Byte)AutoType.Day,
                ET_AutoOffsetDay = 0,
                ET_DifficultyCoefficient = 0,
                ET_AutoClassifies = "[\"综合、公文、绩效知识(90题)\",\"所得税知识(180题)\",\"营业税知识(60题)\",\"其他地方税知识(180题)\",\"税收征管法、相关法律法规及征管制度(253题)\",\"规费知识(130题)\",\"纳税服务知识(95题)\"]",
                ET_AutoRatio = "[{\"type\":\"单选题\",\"percent\":0.2},{\"type\":\"多选题\",\"percent\":0.2},{\"type\":\"判断题\",\"percent\":0.2},{\"type\":\"公文改错题\",\"percent\":0.1},{\"type\":\"计算题\",\"percent\":0.1},{\"type\":\"案例分析题\",\"percent\":0.1},{\"type\":\"问答题\",\"percent\":0.1}]",
                ET_StartTime = startTime,
                ET_EndTime = startTime,
                ET_TimeSpan = 0,
                ET_PaperTemplates = "[]",
                ET_Questions = "[]",
                ET_Remark = "",
                ET_AddTime = now,
                ET_Status = (Byte)Status.Available
            };
            olsEni.Entry(et).State = EntityState.Added;

            startTime = new DateTime(1970, 1, 1, now.Hour, now.Minute, now.AddSeconds(5).Second);
            id += 1;
            et = new ExaminationTask
            {
                ET_Id = id,
                ET_Name = "单元测试每日任务" + id,
                ET_Enabled = (Byte)ExaminationTaskStatus.Enabled,
                ET_Type = (Byte)ExaminationTaskType.Examination,
                ET_ParticipatingDepartment = "[6,9]",
                ET_Attendee = "[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,39,40,41,42,43,44,45]",
                ET_StatisticType = (Byte)StatisticType.Score,
                ET_TotalScore = 100,
                ET_TotalNumber = 10,
                ET_Mode = (Byte)ExaminationTaskMode.Auto,
                ET_AutoType = (Byte)AutoType.Day,
                ET_AutoOffsetDay = 0,
                ET_DifficultyCoefficient = 0,
                ET_AutoClassifies = "[\"综合、公文、绩效知识(90题)\",\"所得税知识(180题)\",\"营业税知识(60题)\",\"其他地方税知识(180题)\",\"税收征管法、相关法律法规及征管制度(253题)\",\"规费知识(130题)\",\"纳税服务知识(95题)\"]",
                ET_AutoRatio = "[{\"type\":\"单选题\",\"percent\":0.2},{\"type\":\"多选题\",\"percent\":0.2},{\"type\":\"判断题\",\"percent\":0.2},{\"type\":\"公文改错题\",\"percent\":0.1},{\"type\":\"计算题\",\"percent\":0.1},{\"type\":\"案例分析题\",\"percent\":0.1},{\"type\":\"问答题\",\"percent\":0.1}]",
                ET_StartTime = startTime,
                ET_EndTime = startTime,
                ET_TimeSpan = 0,
                ET_PaperTemplates = "[]",
                ET_Questions = "[]",
                ET_Remark = "",
                ET_AddTime = now,
                ET_Status = (Byte)Status.Available
            };
            olsEni.Entry(et).State = EntityState.Added;

            if (0 == olsEni.SaveChanges())
            {
                Assert.Fail("部署测试数据失败1。");
            }

            // 生成试卷模板数据
            uet = new UExaminationTask();
            resJson = gpt.Generate();
            if (ResponseStatus.Error == resJson.status || resJson.message != "")
            {
                Assert.Fail("部署测试数据失败3。" + resJson.message);
            }

            Thread.Sleep(10 * 1000);

            ept = olsEni.ExaminationPaperTemplates.SingleOrDefault(m => m.ET_Id == id);
            if (null == ept)
            {
                Assert.Fail("部署测试数据失败4。");
            }

            ept.EPT_PaperTemplateStatus = (Byte)PaperTemplateStatus.Doing;

            if (0 == olsEni.SaveChanges())
            {
                Assert.Fail("部署测试数据失败2。");
            }

            #endregion

            expected = "共有 2条记录。其中“未做” 1条;“进行中” 1条。";
            target = new ChangePaperTemplateStatus();
            actual = target.Change();

            Assert.AreEqual(expected, ((Dictionary<String, String>)(((ResponseJson)actual).data))["RecordInfo"]);
        }