コード例 #1
0
 public void WebBrowserBase_ProcessDialogKey_InvokeWithParent_ReturnsFalse(Keys keyData)
 {
     using var parent = new Control
           {
               Visible = false
           };
     using var control = new SubWebBrowserBase("8856f961-340a-11d0-a96b-00c04fd705a2")
           {
               Parent = parent
           };
     Assert.False(control.ProcessDialogKey(keyData));
     Assert.False(control.IsHandleCreated);
 }
コード例 #2
0
        public void WebBrowserBase_ProcessDialogKey_InvokeWithCustomParent_ReturnsExpected(Keys keyData, bool result)
        {
            int callCount = 0;

            bool action(Keys actualKeyData)
            {
                Assert.Equal(keyData, actualKeyData);
                callCount++;
                return(result);
            }

            using var parent = new CustomProcessControl
                  {
                      ProcessDialogKeyAction = action,
                      Visible = false
                  };
            using var control = new SubWebBrowserBase("8856f961-340a-11d0-a96b-00c04fd705a2")
                  {
                      Parent = parent
                  };
            Assert.Equal(result, control.ProcessDialogKey(keyData));
            Assert.Equal(1, callCount);
            Assert.False(control.IsHandleCreated);
        }