public void RemoveControlOnDisposedControlTest()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            var id   = "id";
            var ctrl = new Button();

            hyperToolTipProvider.SetHyperToolTipId(ctrl, id);

            Assert.AreEqual(id, hyperToolTipProvider.GetHyperToolTipId(ctrl));
            ctrl.Dispose();
            Assert.AreEqual(
                string.Empty, hyperToolTipProvider.GetHyperToolTipId(ctrl), "control is not deregistered automatically");
        }
        public void RemoveControlOnDisposedTabControlTest()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            var id      = "id";
            var tabCtrl = new TabControl();
            var page    = new TabPage();

            tabCtrl.Controls.Add(page);

            hyperToolTipProvider.SetHyperToolTipId(page, id);

            Assert.AreEqual(id, hyperToolTipProvider.GetHyperToolTipId(page));
            tabCtrl.Dispose();
            Assert.AreEqual(
                string.Empty, hyperToolTipProvider.GetHyperToolTipId(page), "control is not deregistered automatically");
        }
        public void DisposeTest()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            var id   = "id";
            var ctrl = new Button();

            hyperToolTipProvider.SetHyperToolTipId(ctrl, id);

            var id2   = "id2";
            var ctrl2 = new Button();

            hyperToolTipProvider.SetHyperToolTipId(ctrl2, id2);

            hyperToolTipProvider.Dispose();

            Assert.AreEqual(string.Empty, hyperToolTipProvider.GetHyperToolTipId(ctrl));
            Assert.AreEqual(string.Empty, hyperToolTipProvider.GetHyperToolTipId(ctrl2));
        }
        public void RemoveControlOnDisposedToolStripTest()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            var id = "id";
            var toolStripButton1 = new ToolStripButton();
            var toolStrip1       = new ToolStrip();

            toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripButton1 });

            hyperToolTipProvider.SetHyperToolTipId(toolStripButton1, id);

            Assert.AreEqual(id, hyperToolTipProvider.GetHyperToolTipId(toolStripButton1));
            toolStrip1.Dispose();
            Assert.AreEqual(
                string.Empty,
                hyperToolTipProvider.GetHyperToolTipId(toolStripButton1),
                "control is not deregistered automatically");
        }
        public void SetGetHyperToolTipIdToolStrip2Test()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            var id = "id";
            var toolStripButton1 = new ToolStripButton();

            // try to set id before button is added to ToolStrip
            hyperToolTipProvider.SetHyperToolTipId(toolStripButton1, id);

            Assert.AreEqual(id, hyperToolTipProvider.GetHyperToolTipId(toolStripButton1));
        }
        public void SetGetHyperToolTipIdTabControl2Test()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            var id   = "id";
            var page = new TabPage();

            // try to set id before page is added to TabControl
            hyperToolTipProvider.SetHyperToolTipId(page, id);

            Assert.AreEqual(id, hyperToolTipProvider.GetHyperToolTipId(page));
        }
        public void SetGetHyperToolTipIdToolStripTest()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            var id = "id";
            var toolStripButton1 = new ToolStripButton();
            var toolStrip1       = new ToolStrip();

            toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripButton1 });

            hyperToolTipProvider.SetHyperToolTipId(toolStripButton1, id);

            Assert.AreEqual(id, hyperToolTipProvider.GetHyperToolTipId(toolStripButton1));
        }
        public void SetGetHyperToolTipIdTabControlTest()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            var id      = "id";
            var tabCtrl = new TabControl();
            var page    = new TabPage();

            tabCtrl.Controls.Add(page);

            hyperToolTipProvider.SetHyperToolTipId(page, id);

            Assert.AreEqual(id, hyperToolTipProvider.GetHyperToolTipId(page));
        }
        public void SetGetHyperToolTipIdControlTest()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            var id   = "id";
            var ctrl = new Button();

            hyperToolTipProvider.SetHyperToolTipId(ctrl, id);

            var id2   = "id2";
            var ctrl2 = new Button();

            hyperToolTipProvider.SetHyperToolTipId(ctrl2, id2);

            Assert.AreEqual(id, hyperToolTipProvider.GetHyperToolTipId(ctrl));
            Assert.AreEqual(id2, hyperToolTipProvider.GetHyperToolTipId(ctrl2));

            // try to override id
            var id3 = "id3";

            hyperToolTipProvider.SetHyperToolTipId(ctrl2, id3);
            Assert.AreEqual(id3, hyperToolTipProvider.GetHyperToolTipId(ctrl2));
        }
        public void GetHyperToolTipIdWrongArg1Test()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            hyperToolTipProvider.GetHyperToolTipId(null);
        }
        public void GetHyperToolTipIdForNotRegisteredControlTest()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            Assert.AreEqual(string.Empty, hyperToolTipProvider.GetHyperToolTipId(new Button()));
        }
        public void GetHyperToolTipIdWrongArg3Test()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            hyperToolTipProvider.GetHyperToolTipId("xxx");
        }
        public void GetHyperToolTipIdWrongArg2Test()
        {
            var hyperToolTipProvider = new HyperToolTipProvider();

            hyperToolTipProvider.GetHyperToolTipId(new TabControl());
        }