Exemplo n.º 1
0
        public int AddTest()
        {
            var result = Operate.Add(1, 2);

            Assert.That(result, Is.GreaterThan(2));
            Assert.That(result, Is.EqualTo(3));
            return(result);
        }
Exemplo n.º 2
0
        private void InitializeComponent()
        {
            _lblKeyMessageTitle = new Label();
            _lblKeyMessage      = new Label();

            Controls.Add(_lblKeyMessageTitle);
            Controls.Add(_lblKeyMessage);

            Icon          = (Icon) new ComponentResourceManager(typeof(MainForm)).GetObject("$this.Icon");
            Size          = new Size(700, 350);
            StartPosition = FormStartPosition.CenterScreen;
            MaximizeBox   = false;
            MinimizeBox   = false;
            KeyPreview    = true;
            Text          = Title;
            KeyDown      += (_, e) =>
            {
                Operate ??= new List <Keys>();
                if (Operate.Contains(e.KeyCode))
                {
                    return;
                }
                Operate.Add(e.KeyCode);
            };
            KeyUp += (_, _) =>
            {
                Close();
            };

            _lblKeyMessageTitle.Size      = new Size(700, 82);
            _lblKeyMessageTitle.Location  = new Point(-15, 50);
            _lblKeyMessageTitle.TabIndex  = 0;
            _lblKeyMessageTitle.Text      = "按下想要模拟的按键后松开即可";
            _lblKeyMessageTitle.TextAlign = ContentAlignment.MiddleCenter;
            _lblKeyMessageTitle.Font      = new Font("宋体", 12F, FontStyle.Bold, GraphicsUnit.Point, 134);

            _lblKeyMessage.Size      = new Size(700, 82);
            _lblKeyMessage.Location  = new Point(-15, 135);
            _lblKeyMessage.TabIndex  = 0;
            _lblKeyMessage.Text      = "支持组合键";
            _lblKeyMessage.TextAlign = ContentAlignment.MiddleCenter;
            _lblKeyMessage.Font      = new Font("宋体", 12F, FontStyle.Bold, GraphicsUnit.Point, 134);
        }
Exemplo n.º 3
0
 protected void btnok_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp("AddOperate"))
     {
         base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền");
     }
     else
     {
         OperateInfo operateInfo = new OperateInfo
         {
             ModuleID      = base.OpID,
             OperateName   = WebUtils.GetString(this.TextBox1.Text),
             OperateCode   = WebUtils.GetString(this.TextBox2.Text),
             AutoTimeStamp = System.DateTime.Now
         };
         if (string.IsNullOrEmpty(operateInfo.OperateName) || string.IsNullOrEmpty(operateInfo.OperateCode))
         {
             base.ShowMsg("操作名称和操作代码不能为空");
         }
         else if (Operate.Add(operateInfo) > 0)
         {
             this.BindData();
             PageBase.log.AddEvent(base.AccountName, string.Concat(new string[]
             {
                 "添加模板[",
                 this.module.ModuleName,
                 "]的操作[",
                 operateInfo.OperateName,
                 "] thành công"
             }));
             base.ShowMsg("添加成功");
         }
         else
         {
             base.ShowMsg("添加失败");
         }
     }
 }
Exemplo n.º 4
0
        public void AddTest3([Values(1, 2)] int a, [Values(2, 1)] int b)
        {
            var result = Operate.Add(a, b);

            Assert.That(result, Is.LessThanOrEqualTo(4));
        }
Exemplo n.º 5
0
        public int AddTest2(int a, int b)
        {
            var result = Operate.Add(a, b);

            return(result);
        }