public async Task Process_MethodRunsWithTestClassAndTestGroup_ReturnsTestResult() { await RunDependencyInjectedTestAsync ( async (serviceProvider) => { // Arrange var exampleMixedClass = new MixedClass(); var expectedMethodInfos = exampleMixedClass .GetType() .GetMethods(BindingFlags.Public | BindingFlags.Instance) .Where ( methodInfo => methodInfo.GetParameters().Length == 1 && methodInfo.GetParameters()[0].Name == IntegrationTestService.SUCCESSLOG_PRAM_NAME && methodInfo.GetParameters()[0].ParameterType == typeof(List <string>) && methodInfo.ReturnType == typeof(Task) ); var testAPIAttribute = (TestAPIAttribute)System.Attribute.GetCustomAttributes(exampleMixedClass.GetType()).FirstOrDefault(e => e is TestAPIAttribute); var test = new Models.TestAutomation.Test() { MethodInfo = expectedMethodInfos.First(), TestClass = exampleMixedClass, TestGroup = testAPIAttribute.Group, TestsName = testAPIAttribute.Name }; var uut = serviceProvider.GetRequiredService <IIntegrationTestService>(); var uutConcrete = (IntegrationTestService)uut; // Act var observed = await uutConcrete.Process(test.TestClass, test).ConfigureAwait(false); // Assert Assert.IsNotNull(observed); Assert.AreEqual(test.MethodInfo.ReflectedType.Name, observed.ClassName); Assert.AreEqual(test.TestGroup, observed.TestGroup); Assert.AreEqual(test.TestsName, observed.TestsName); Assert.IsNotNull(observed.CorrelationId); Assert.IsNotNull(observed.Duration); Assert.IsNotNull(observed.EndTime); Assert.IsNull(observed.Exception); Assert.IsNotNull(observed.ExecutionId); Assert.IsTrue(observed.Pass); Assert.IsNotNull(observed.StartTime); Assert.AreEqual(0, observed.SuccessLog.Count()); Assert.IsNotNull(observed.TestId); Assert.IsNotNull(test.MethodInfo.Name, observed.TestName); Assert.IsNotNull(observed.TestType); }, serviceCollection => ConfigureServices(serviceCollection) ); }
void Sort() { try { TransactionOptions transactionOption = new TransactionOptions(); transactionOption.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; using (TransactionScope tran = new TransactionScope(TransactionScopeOption.Required, transactionOption)) { progressBar1.Value = (progressBar1.Maximum / 2); var re = sc.SchedulePoke(); //排程结束后,对排程数据进行验证 ValidationClass vc = new ValidationClass(); Response response = vc.ValidationSchedule("2"); if (response.IsSuccess) { if (re.IsSuccess) { List <MixedInfo> list = MixedClass.GetUnPokeData(); MixedClass.InsertPokeMixed(list); tran.Complete(); btnPokeSeq.Enabled = true; progressBar1.Value = progressBar1.Maximum; //TimerByTime.Stop();// 计时结束; btnSort.Enabled = true; lblInFO.Text = "分拣车组任务排程成功!" + "\r\n" + "所用时间:" + times + "秒"; MessageBox.Show("分拣车组任务排程成功!" + "\r\n" + "所用时间:" + times + "秒", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { panel2.Visible = false; TimerByTime.Stop();// 计时结束; btnSort.Enabled = true; MessageBox.Show(re.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { //回滚排程操作 MessageBox.Show(response.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception e) { MessageBox.Show("排程异常:" + e.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { //dgvSortInfo.Rows.Clear(); //List<TaskInfo> list = new List<TaskInfo>(); //dgvSortInfo.DataSource = list; Bind(); panel2.Visible = false; TimerByTime.Stop();// 计时结束; btnSort.Enabled = true; } }
void GetData() { WriteLog.GetLog().Write("读取数据"); StringBuilder sb = new StringBuilder(); WriteLog.GetLog().Write("开始获取数据" + DateTime.Now.ToString()); string strStart = System.DateTime.Now.ToString(); List <MixInfo> list = new List <MixInfo>(); foreach (var item in lbladded) { item.Text = ""; item.BackColor = Color.White; } foreach (var item in lbladd) { item.Text = ""; } try { list = MixedClass.GetMixCig(machineSeq, groupNo, 0); int length; if (list.Count > lbladded.Length) { length = lbladded.Length; } else { length = list.Count; } UpdateLabel(list, length, lbladd); try { List <MixInfo> finish = new List <MixInfo>(); finish = MixedClass.GetMixCig3(machineSeq, groupNo, 1).Take(15).OrderBy(item => item.SortNum).ToList(); int lengths; if (finish.Count > lbladded.Length) { lengths = lbladded.Length; } else { lengths = finish.Count; } UpdateLabel(finish, lengths, lbladded); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } catch (Exception ex) { WriteLog.GetLog().Write("sp-03:数据获取失败! "); databaselinkcheck("数据库连接失败!请检查网络,重新打开程序!"); } }
void PullCigarette() { StringBuilder sb = new StringBuilder(); MixInfo info = MixedClass.GetMixCig(machineSeq, groupNo, 0)[0]; if (MixedClass.UpdatePullStatus2Put3(info.CigCode, machineSeq, info.SortNum)) { WriteLog.GetLog().Write("<点击放烟成功>"); BtnRemove.Enabled = false; BtnRemove.Visible = false; GetData(); } }
public void TestMixedClassToXElement() { var allInOneClass = MixedClassImpl; var result = allInOneClass.ExportAsXElement(); var withoutXmlHeader = XDocument.Parse(ComparisonValues.Mixed).Root; Assert.True(XNode.DeepEquals(withoutXmlHeader, result)); var deserialized = MixedClass.Import(result); Assert.True(allInOneClass.DeepEquals(deserialized, nameof(IZenonSerializable.ObjectStatus))); }
public static void RunMixedAdd() { result = 0; for (int i = 0; i < MAX_CALL; i++) { result += MixedClass.SimpleAddMixed(i, 1); result += MixedClass.SimpleAddMixed(i, i); result += MixedClass.SimpleAddMixed(i, 1); result += MixedClass.SimpleAddMixed(i, i); result += MixedClass.SimpleAddMixed(i, 1); result += MixedClass.SimpleAddMixed(i, i); result += MixedClass.SimpleAddMixed(i, 1); result += MixedClass.SimpleAddMixed(i, i); result += MixedClass.SimpleAddMixed(i, 1); result += MixedClass.SimpleAddMixed(i, i); } }
public async Task RunTests_MethodRuns_ReturnsTestResults() { await RunDependencyInjectedTestAsync ( async (serviceProvider) => { // Arrange var exampleTestClass = new MixedClass(); var expectedMethodInfos = exampleTestClass .GetType() .GetMethods(BindingFlags.Public | BindingFlags.Instance) .Where(e => e.DeclaringType.Name == exampleTestClass.GetType().Name); var tests = new List <Models.TestAutomation.Test> { new Models.TestAutomation.Test() { MethodInfo = expectedMethodInfos.First(), TestClass = exampleTestClass }, new Models.TestAutomation.Test() { MethodInfo = expectedMethodInfos.Last(), TestClass = exampleTestClass } }; var uut = serviceProvider.GetRequiredService <IIntegrationTestService>(); var uutConcrete = (IntegrationTestService)uut; // Act var observed = await uutConcrete.RunTests(tests).ConfigureAwait(false); // Assert Assert.IsNotNull(observed); Assert.IsNotNull(observed.Duration); Assert.IsNotNull(observed.EndDateTime); Assert.IsNotNull(observed.StartDateTime); Assert.AreEqual(2, observed.TestResults.Count()); }, serviceCollection => ConfigureServices(serviceCollection) ); }
private void LblAdd1_Click(object sender, EventArgs e) { DialogResult dia = MessageBox.Show("确认放烟:" + list[0].CigName + " ?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dia == DialogResult.Cancel) { return; } WriteLog.GetLog().Write("手动开始时间" + DateTime.Now.ToString()); for (int i = 0; i < list[0].PokeIDList.Count; i++) { MixedClass.UpdatePullStatus2Put2(machineSeq, Convert.ToDecimal(list[0].PokeIDList[i])); } WriteLog.GetLog().Write("数据库更新完时间" + DateTime.Now.ToString()); WriteLog.GetLog().Write("<手动点击放烟" + list[0].CigName + "成功>"); GetData(); WriteLog.GetLog().Write("再次取数据时间" + DateTime.Now.ToString()); }
public static void RunMixedCppCli() { Array.Copy(om1, m1, 16); for (int i = 0; i < MAX_CALL; i++) { MixedClass.matrix_mul(pm1, pm2, pm3); MixedClass.matrix_mul(pm3, pm2, pm1); MixedClass.matrix_mul(pm1, pm2, pm3); MixedClass.matrix_mul(pm3, pm2, pm1); MixedClass.matrix_mul(pm1, pm2, pm3); MixedClass.matrix_mul(pm3, pm2, pm1); MixedClass.matrix_mul(pm1, pm2, pm3); MixedClass.matrix_mul(pm3, pm2, pm1); MixedClass.matrix_mul(pm1, pm2, pm3); MixedClass.matrix_mul(pm3, pm2, pm1); Array.Copy(om1, m1, 16); } }
public async Task SetupTests_MixedClass_ReturnsExpectedResult() { await RunDependencyInjectedTestAsync ( async (serviceProvider) => { //Setup var exampleMixedClass = new MixedClass(); var expectedTestNames = "MixedTests"; var expectedTestGroup = "TestGroup"; var uut = serviceProvider.GetRequiredService <IIntegrationTestService>(); var uutConcrete = (IntegrationTestService)uut; //Act var observed = uutConcrete.SetupTests(exampleMixedClass); //Assert Assert.AreEqual(4, observed.Count()); var observedList = observed.ToList(); Assert.AreEqual("MethodFive_Match", observedList[0].MethodInfo.Name); Assert.AreEqual("MethodSix_Matchs", observedList[1].MethodInfo.Name); Assert.AreEqual("MethodSeven_Matchs", observedList[2].MethodInfo.Name); Assert.AreEqual("MethodEight_Matchs", observedList[3].MethodInfo.Name); Assert.AreEqual(expectedTestNames, observedList[0].TestsName); Assert.AreEqual(expectedTestNames, observedList[1].TestsName); Assert.AreEqual(expectedTestNames, observedList[2].TestsName); Assert.AreEqual(expectedTestNames, observedList[3].TestsName); Assert.AreEqual(expectedTestGroup, observedList[0].TestGroup); Assert.AreEqual(expectedTestGroup, observedList[1].TestGroup); Assert.AreEqual(expectedTestGroup, observedList[2].TestGroup); Assert.AreEqual(expectedTestGroup, observedList[3].TestGroup); await Task.CompletedTask.ConfigureAwait(false); }, serviceCollection => ConfigureServices(serviceCollection) ); }
private void btn_close_Click(object sender, EventArgs e) { DataGridViewRow dvr = batchdata.CurrentRow; if (dvr != null) { string batchcode = dvr.Cells["batchcode"].Value.ToString(); Response response = bc.OperationBatch(batchcode, 2); if (response.IsSuccess) { MixedClass.RemoveHunhe(); } MessageBox.Show(response.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("请选中需要关闭的批次!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void PullCigarette(string stri) { MixInfos info = MixedClass.GetMixCig2(machineSeq, groupNo, 0)[0]; WriteLog.GetLog().Write("扫到条码" + stri); if (info.CigCode.Trim().Contains(str) || info.CigCode.Trim() == str || info.CigCode.Trim().Substring(info.CigCode.Trim().Length - 7) == stri.Trim().Substring(info.CigCode.Trim().Length - 7) || info.CigCode.Trim().Contains(stri.Trim().Substring(info.CigCode.Trim().Length - 7))) { if (MixedClass.UpdatePullStatus2Put2(machineSeq, info.PokeID)) { WriteLog.GetLog().Write("<扫码放烟成功>"); GetData(); str = ""; } } else { WriteLog.GetLog().Write("放烟品牌错误:扫描到条码" + str[0]); MessageBox.Show("放烟错误,请重放" + str); str = ""; } }
void PullCigarette(string stri) { MixInfo info = MixedClass.GetMixCig(machineSeq, groupNo, 0)[0]; WriteLog.GetLog().Write("扫到条码" + stri); if (info.CigCode.Trim() == stri.Trim() /* && info.CigName == strs[1].Trim()*/) { if (MixedClass.UpdatePullStatus2Put(machineSeq, info.SortNum, info.CigCode)) { WriteLog.GetLog().Write("<扫码放烟成功>"); BtnRemove.Enabled = false; BtnRemove.Visible = false; GetData(); str = ""; } } else { WriteLog.GetLog().Write("放烟品牌错误:扫描到条码" + stri); MessageBox.Show("放烟错误,请重放"); str = ""; } }
void GetData() { //list = new List<MixInfos>(); //foreach (var item in lbladded) //{ UpdateLabel3(new List <MixInfos>(), 15, lbladded, Color.White); // //item.Text = ""; //} //foreach (var item in lbladd) //{ UpdateLabel3(new List <MixInfos>(), 15, lbladd, Color.White); // //item.Text = ""; // //item.BackColor = Color.White; //} try { list = MixedClass.GetMixCig2(machineSeq, groupNo, 0); int length; List <MixInfos> lists = new List <MixInfos>(); lists = GroupList(list); if (lists.Count > lbladded.Length) { length = lbladded.Length; } else { length = lists.Count; } UpdateLabel3(lists, length, lbladd, Color.White); try { List <MixInfos> finish = new List <MixInfos>(); //UpdateLabel(finish, 15, lbladded); finish = MixedClass.GetMixCig4(machineSeq, groupNo, 1).OrderByDescending(item => item.ThroughNum).OrderByDescending(item => item.SortNum).ToList(); int lengths; List <MixInfos> finishs = new List <MixInfos>(); finishs = GroupList(finish).Take(15).OrderBy(item => item.ThroughNum).OrderBy(item => item.SortNum).ToList(); if (finishs.Count > lbladded.Length) { lengths = lbladded.Length; } else { lengths = finishs.Count; } UpdateLabel3(finishs, lengths, lbladded, Color.LightGreen); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } catch (Exception ex) { WriteLog.GetLog().Write("sp-03:数据获取失败! "); //if (ex.Message == "基础提供程序在 Open 上失败。") //{ databaselinkcheck("数据库连接失败!请检查网络,重新打开程序!"); //} } }