public void ShouldThrowExceptionForNullUnhoverElement()
 {
     IHoverControlBean bean = new HoverControlBean();
     bean.UnhoverElement = null;
 }
 public void ShouldReturnFalseForIsHoverAndClickControl()
 {
     IHoverControlBean bean = new HoverControlBean();
     Assert.IsFalse(bean.IsHoverAndClickControl());
 }
 public void ShouldReturnTrueForIsHoverControl()
 {
     IHoverControlBean bean = new HoverControlBean();
     Assert.IsTrue(bean.IsHoverControl());
 }
        public void ShouldNotBeEqual()
        {
            IHoverControlBean beanOne = new HoverControlBean();
            IHoverControlBean beanTwo = new HoverControlBean();

            Mock<IWebElement> mockContainerElementOne = new Mock<IWebElement>();
            Mock<IWebElement> mockContainerElementTwo = new Mock<IWebElement>();

            beanOne.ContentContainer = mockContainerElementOne.Object;
            beanTwo.ContentContainer = mockContainerElementTwo.Object;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different container element references should not be " +
                "equal");

            Mock<IWebElement> mockUnhoverElementOne = new Mock<IWebElement>();
            Mock<IWebElement> mockUnhoverElementTwo = new Mock<IWebElement>();

            beanTwo.ContentContainer = mockContainerElementOne.Object;
            beanOne.UnhoverElement= mockUnhoverElementOne.Object;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different unhover element references should not be equal");

            beanTwo.UnhoverElement = mockUnhoverElementTwo.Object;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different unhover element references should not be equal");

            beanTwo.UnhoverElement = mockUnhoverElementOne.Object;
            beanOne.HoverWithJavascript = true;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different JavaScript hover workaround values should not " +
                "be equal");

            beanTwo.HoverWithJavascript = true;
            beanOne.UnhoverWithJavascript = true;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different JavaScript unhover workaround values should " +
                "not be equal");

            beanTwo.UnhoverWithJavascript = true;
            beanOne.ClickInsteadOfHover = true;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different click action hover workaround values should " +
                "not be equal");

            beanTwo.ClickInsteadOfHover = true;
            beanOne.ClickWithJavascriptInsteadOfHover = true;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different JavaScript click action hover workaround " +
                "values should not be equal");

            beanTwo.ClickWithJavascriptInsteadOfHover = true;
            beanOne.UnhoverWithClickInstead = true;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different click action unhover workaround values should " +
                "not be equal");

            beanTwo.UnhoverWithClickInstead = true;
            beanOne.UnhoverWithJavascriptClickInstead = true;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different JavaScript click action unhover workaround " +
                "values should not be equal");
        }
        public void ShouldBeEqual()
        {
            IHoverControlBean beanOne = new HoverControlBean();
            IHoverControlBean beanTwo = new HoverControlBean();

            Assert.AreEqual(beanOne, beanTwo, "Two newly constructed beans should be equal before any setters are " +
                "invoked");

            Mock<IWebElement> mockContainerElement = new Mock<IWebElement>();

            beanOne.ContentContainer = mockContainerElement.Object;
            beanTwo.ContentContainer = mockContainerElement.Object;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container element " +
                "reference and same default JavaScript click workaround value");

            Mock<IWebElement> mockUnhoverElement = new Mock<IWebElement>();

            beanOne.UnhoverElement = mockUnhoverElement.Object;
            beanTwo.UnhoverElement = mockUnhoverElement.Object;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container and unhover " +
                "element references and same default workaround values");

            beanOne.HoverWithJavascript = true;
            beanTwo.HoverWithJavascript = true;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container and unhover " +
                "element references and same non-default JavaScript hover workaround value");

            beanOne.HoverWithJavascript = false;
            beanTwo.HoverWithJavascript = false;
            beanOne.UnhoverWithJavascript = true;
            beanTwo.UnhoverWithJavascript = true;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container and unhover " +
                "element references and same non-default JavaScript unhover workaround value");

            beanOne.UnhoverWithJavascript = false;
            beanTwo.UnhoverWithJavascript = false;
            beanOne.ClickInsteadOfHover = true;
            beanTwo.ClickInsteadOfHover = true;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container and unhover " +
                "element references and same non-default click action hover workaround value");

            beanOne.ClickInsteadOfHover = false;
            beanTwo.ClickInsteadOfHover = false;
            beanOne.ClickWithJavascriptInsteadOfHover = true;
            beanTwo.ClickWithJavascriptInsteadOfHover = true;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container and unhover " +
                "element references and same non-default JavaScript click action hover workaround value");

            beanOne.ClickWithJavascriptInsteadOfHover = false;
            beanTwo.ClickWithJavascriptInsteadOfHover = false;
            beanOne.UnhoverWithJavascript = true;
            beanTwo.UnhoverWithJavascript = true;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container and unhover " +
                "element references and same non-default click action unhover workaround value");

            beanOne.UnhoverWithJavascript = false;
            beanTwo.UnhoverWithJavascript = false;
            beanOne.UnhoverWithClickInstead = true;
            beanTwo.UnhoverWithClickInstead = true;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container and unhover " +
                "element references and same non-default click action unhover workaround value");

            beanOne.UnhoverWithClickInstead = false;
            beanTwo.UnhoverWithClickInstead = false;
            beanOne.UnhoverWithJavascriptClickInstead = true;
            beanTwo.UnhoverWithJavascriptClickInstead = true;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container and unhover " +
                "element references and same non-default JavaScript click action unhover workaround value");

            beanOne = new HoverControlBean();
            beanTwo = new HoverControlBean();

            beanOne.HoverWithJavascript = true;
            beanTwo.HoverWithJavascript = true;
            beanOne.UnhoverWithJavascript = true;
            beanTwo.UnhoverWithJavascript = true;
            beanOne.ClickInsteadOfHover = true;
            beanTwo.ClickInsteadOfHover = true;
            beanOne.ClickWithJavascriptInsteadOfHover = true;
            beanTwo.ClickWithJavascriptInsteadOfHover = true;
            beanOne.UnhoverWithClickInstead = true;
            beanTwo.UnhoverWithClickInstead = true;
            beanOne.UnhoverWithJavascriptClickInstead = true;
            beanTwo.UnhoverWithJavascriptClickInstead = true;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have null container and unhover " +
                "element references and same non-default JavaScript hover workaround values");
        }
        public void ShouldCallBaseForHashCode()
        {
            IHoverControlBean bean = new HoverControlBean();
            IHoverControlBean beanToCompare = new HoverControlBean();

            Assert.AreEqual(bean.GetHashCode(), beanToCompare.GetHashCode(), "Hash codes for bean which have not had " +
                "setters called should be equal, but are not: " + bean.ToString() + ", " + beanToCompare.ToString());

            Mock<IWebElement> mockElement = new Mock<IWebElement>();

            bean.ContentContainer = mockElement.Object;
            Assert.AreNotEqual(bean.GetHashCode(), beanToCompare.GetHashCode(), "Hash codes for bean which have " +
                "different values for their container element fields should not be equal, but are: " +
                bean.ToString() + ", " + beanToCompare.ToString());

            beanToCompare.ContentContainer = mockElement.Object;
            Assert.AreEqual(bean.GetHashCode(), beanToCompare.GetHashCode(), "Hash codes for bean which have the " +
                "same container element should be equal, but are not: " + bean.ToString() + ", " +
                beanToCompare.ToString());
        }
        public void ShouldCallBaseForToString()
        {
            Mock<IWebElement> mockElement = new Mock<IWebElement>();

            IHoverControlBean bean = new HoverControlBean();
            bean.ContentContainer = mockElement.Object;

            Assert.AreEqual("HoverControlBean(ContentContainerBean(LoadableBean(Driver: null, LoadTimeout: 30), " +
                "ContentContainer: " + mockElement.Object.ToString() + "), UnhoverElement: null, " +
                "HoverWithJavascript: False, UnhoverWithJavascript: False, ClickInsteadOfHover: False, " +
                "ClickWithJavascriptInsteadOfHover: False, UnhoverWithClickInstead: False, " +
                "UnhoverWithJavascriptClickInstead: False)", bean.ToString());
        }
        public void ShouldBeEqual()
        {
            IDynamicControllableBean beanOne = new DynamicControllableBean();
            IDynamicControllableBean beanTwo = new DynamicControllableBean();

            Assert.AreEqual(beanOne, beanTwo, "Two newly constructed beans should be equal before any setters are " +
                "invoked");

            Mock<IClickControlBean> mockClickControlBean = new Mock<IClickControlBean>();
            beanOne.AddClickControl("name", mockClickControlBean.Object);
            beanTwo.AddClickControl("name", mockClickControlBean.Object);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same click control bean " +
                "instance mapped to the same name");

            beanOne = new DynamicControllableBean();
            beanTwo = new DynamicControllableBean();

            IClickControlBean clickControlBeanOne = new ClickControlBean();
            IClickControlBean clickControlBeanTwo = new ClickControlBean();

            Mock<IWebElement> mockContainerElement = new Mock<IWebElement>();

            clickControlBeanOne.ContentContainer = mockContainerElement.Object;
            clickControlBeanTwo.ContentContainer = mockContainerElement.Object;
            clickControlBeanOne.ClickWithJavascript = true;
            clickControlBeanTwo.ClickWithJavascript = true;

            beanOne.AddClickControl("name", clickControlBeanOne);
            beanTwo.AddClickControl("name", clickControlBeanTwo);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have different click control bean " +
                "instance mapped to the same name which have the same content container reference and the same " +
                "non-default Javascript click workaround value");

            beanOne = new DynamicControllableBean();
            beanTwo = new DynamicControllableBean();

            IHoverControlBean hoverControlBeanOne = new HoverControlBean();
            IHoverControlBean hoverControlBeanTwo = new HoverControlBean ();

            hoverControlBeanOne.ContentContainer = mockContainerElement.Object;
            hoverControlBeanTwo.ContentContainer = mockContainerElement.Object;
            hoverControlBeanOne.ClickInsteadOfHover = true;
            hoverControlBeanTwo.ClickInsteadOfHover = true;

            beanOne.AddHoverControl("name", hoverControlBeanOne);
            beanTwo.AddHoverControl("name", hoverControlBeanTwo);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have different hover control bean " +
                "instances mapped to the same name which have the same content container reference and the same " +
                "non-default click instead of hover workaround value");

            beanOne = new DynamicControllableBean();
            beanTwo = new DynamicControllableBean();

            IHoverAndClickControlBean hoverAndClickControlBeanOne = new HoverAndClickControlBean();
            IHoverAndClickControlBean hoverAndClickControlBeanTwo = new HoverAndClickControlBean();

            hoverAndClickControlBeanOne.ContentContainer = mockContainerElement.Object;
            hoverAndClickControlBeanTwo.ContentContainer = mockContainerElement.Object;
            hoverAndClickControlBeanOne.ClickWithJavascript = true;
            hoverAndClickControlBeanTwo.ClickWithJavascript = true;

            beanOne.AddHoverAndClickControl("name", hoverAndClickControlBeanOne);
            beanTwo.AddHoverAndClickControl("name", hoverAndClickControlBeanTwo);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have different hover and click " +
                "control bean instance mapped to the same name which have the same content container reference and " +
                "the same non-default Javascript click instead of hover workaround value");

            beanOne = new DynamicControllableBean();
            beanTwo = new DynamicControllableBean();

            beanOne.PollingTimeout = 40;
            beanTwo.PollingTimeout = 40;
            beanOne.PollingInterval = 5;
            beanTwo.PollingInterval = 5;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have null container the same " +
                "non-default JavaScript hover workaround values and the same non-default polling timeout and polling " +
                "interval");
        }
        public void ShouldNotBeEqual()
        {
            Mock<IWebElement> mockElement = new Mock<IWebElement>();

            IDynamicControllableBean beanOne = new DynamicControllableBean();
            IDynamicControllableBean beanTwo = new DynamicControllableBean();

            IClickControlBean clickControlBeanOne = new ClickControlBean();
            IClickControlBean clickControlBeanTwo = new ClickControlBean();

            clickControlBeanOne.ContentContainer = mockElement.Object;
            clickControlBeanTwo.ContentContainer = mockElement.Object;
            clickControlBeanOne.ClickWithJavascript = true;

            beanOne.AddClickControl("name", clickControlBeanOne);
            beanTwo.AddClickControl("name", clickControlBeanTwo);

            Assert.AreNotEqual(beanOne, beanTwo, "Two beans should not be equal if they different click control bean " +
                "instance mapped to the same name which have the same content container reference but different " +
                "Javascript click workaround values");

            beanOne = new DynamicControllableBean();
            beanTwo = new DynamicControllableBean();

            beanOne.AddClickControl("clickControlOne", clickControlBeanOne);
            beanTwo.AddClickControl("clickControlTwo", clickControlBeanOne);

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with the same click control bean instance mapped to " +
                "different names should not be equal");

            beanOne = new DynamicControllableBean();
            beanTwo = new DynamicControllableBean();

            IHoverControlBean hoverControlBeanOne = new HoverControlBean();
            IHoverControlBean hoverControlBeanTwo = new HoverControlBean();

            hoverControlBeanOne.ContentContainer = mockElement.Object;
            hoverControlBeanTwo.ContentContainer = mockElement.Object;
            hoverControlBeanOne.HoverWithJavascript = true;

            beanOne.AddHoverControl("hoverControl", hoverControlBeanOne);
            beanTwo.AddHoverControl("hoverControl", hoverControlBeanTwo);

            Assert.AreNotEqual(beanOne, beanTwo, "Two beans should not be equal if they have different hover control " +
                "bean instance mapped to the same name which have the same content container reference but different " +
                "Javascript hover workaround values");

            beanOne = new DynamicControllableBean();
            beanTwo = new DynamicControllableBean();

            beanOne.AddHoverControl("hoverControlOne", hoverControlBeanOne);
            beanTwo.AddHoverControl("hoverControlTwo", hoverControlBeanOne);

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with the same hover control bean instance mapped to " +
                "different names should not be equal");

            beanOne = new DynamicControllableBean();
            beanTwo = new DynamicControllableBean();

            IHoverAndClickControlBean hoverAndClickControlBeanOne = new HoverAndClickControlBean();
            IHoverAndClickControlBean hoverAndClickControlBeanTwo = new HoverAndClickControlBean();

            hoverAndClickControlBeanOne.ContentContainer = mockElement.Object;
            hoverAndClickControlBeanTwo.ContentContainer = mockElement.Object;
            hoverAndClickControlBeanOne.HoverWithJavascript = true;

            beanOne.AddHoverAndClickControl("hoverAndClickControl", hoverAndClickControlBeanOne);
            beanTwo.AddHoverAndClickControl("hoverAndClickControl", hoverAndClickControlBeanTwo);

            Assert.AreNotEqual(beanOne, beanTwo, "Two beans should not be equal if they have different hover and " +
                "click control bean instance mapped to the same name which have the same content container reference " +
                "but different Javascript hover workaround values");

            beanOne = new DynamicControllableBean();
            beanTwo = new DynamicControllableBean();

            beanOne.AddHoverAndClickControl("hoverAndClickControlOne", hoverAndClickControlBeanOne);
            beanTwo.AddHoverAndClickControl("hoverAndClickControlTwo", hoverAndClickControlBeanOne);

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with the same hover and click control bean instance mapped " +
                "to different names should not be equal");

            beanTwo.PollingTimeout = 40;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different polling timeouts should not be equal");

            beanTwo.PollingTimeout = 30;
            beanTwo.PollingInterval = 5;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different polling intervals should not be equal");
        }
        public void ShouldNotBeEqual()
        {
            Mock<IWebElement> mockElementOne = new Mock<IWebElement>();
            Mock<IWebElement> mockElementTwo = new Mock<IWebElement>();

            IControllableBean beanOne = new ControllableBean();
            IControllableBean beanTwo = new ControllableBean();

            beanOne.ContentContainer = mockElementOne.Object;
            beanTwo.ContentContainer = mockElementTwo.Object;

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with different container element references should not be " +
                "equal");

            beanTwo.ContentContainer = mockElementOne.Object;

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.ContentContainer = mockElementOne.Object;
            beanTwo.ContentContainer = mockElementOne.Object;

            IClickControlBean clickControlBeanOne = new ClickControlBean();
            IClickControlBean clickControlBeanTwo = new ClickControlBean();

            clickControlBeanOne.ContentContainer = mockElementTwo.Object;
            clickControlBeanTwo.ContentContainer = mockElementTwo.Object;
            clickControlBeanOne.ClickWithJavascript = true;

            beanOne.AddClickControl("name", clickControlBeanOne);
            beanTwo.AddClickControl("name", clickControlBeanTwo);

            Assert.AreNotEqual(beanOne, beanTwo, "Two beans should not be equal if they have the same container " +
                "element reference and different click control bean instance mapped to the same name which have the " +
                "same content container reference but different Javascript click workaround values");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddClickControl("clickControlOne", clickControlBeanOne);
            beanTwo.AddClickControl("clickControlTwo", clickControlBeanOne);

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with the same click control bean instance mapped to " +
                "different names should not be equal");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            IHoverControlBean hoverControlBeanOne = new HoverControlBean();
            IHoverControlBean hoverControlBeanTwo = new HoverControlBean();

            hoverControlBeanOne.ContentContainer = mockElementTwo.Object;
            hoverControlBeanTwo.ContentContainer = mockElementTwo.Object;
            hoverControlBeanOne.HoverWithJavascript = true;

            beanOne.AddHoverControl("hoverControl", hoverControlBeanOne);
            beanTwo.AddHoverControl("hoverControl", hoverControlBeanTwo);

            Assert.AreNotEqual(beanOne, beanTwo, "Two beans should not be equal if they have the same container " +
                "element reference and different hover control bean instance mapped to the same name which have the " +
                "same content container reference but different Javascript hover workaround values");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddHoverControl("hoverControlOne", hoverControlBeanOne);
            beanTwo.AddHoverControl("hoverControlTwo", hoverControlBeanOne);

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with the same hover control bean instance mapped to " +
                "different names should not be equal");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            IHoverAndClickControlBean hoverAndClickControlBeanOne = new HoverAndClickControlBean();
            IHoverAndClickControlBean hoverAndClickControlBeanTwo = new HoverAndClickControlBean();

            hoverAndClickControlBeanOne.ContentContainer = mockElementTwo.Object;
            hoverAndClickControlBeanTwo.ContentContainer = mockElementTwo.Object;
            hoverAndClickControlBeanOne.HoverWithJavascript = true;

            beanOne.AddHoverAndClickControl("hoverAndClickControl", hoverAndClickControlBeanOne);
            beanTwo.AddHoverAndClickControl("hoverAndClickControl", hoverAndClickControlBeanTwo);

            Assert.AreNotEqual(beanOne, beanTwo, "Two beans should not be equal if they have the same container " +
                "element reference and different hover and click control bean instance mapped to the same name which " +
                "have the same content container reference but different Javascript hover workaround values");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddHoverAndClickControl("hoverAndClickControlOne", hoverAndClickControlBeanOne);
            beanTwo.AddHoverAndClickControl("hoverAndClickControlTwo", hoverAndClickControlBeanOne);

            Assert.AreNotEqual(beanOne, beanTwo, "Beans with the same hover and click control bean instance mapped " +
                "to different names should not be equal");
        }
        public void ShouldBeEqual()
        {
            IControllableBean beanOne = new ControllableBean();
            IControllableBean beanTwo = new ControllableBean();

            Assert.AreEqual(beanOne, beanTwo, "Two newly constructed beans should be equal before any setters are " +
                "invoked");

            Mock<IWebElement> mockContainerElementOne = new Mock<IWebElement>();

            beanOne.ContentContainer = mockContainerElementOne.Object;
            beanTwo.ContentContainer = mockContainerElementOne.Object;

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container element " +
                "reference and same default JavaScript click workaround value");

            Mock<IClickControlBean> mockClickControlBean = new Mock<IClickControlBean>();
            beanOne.AddClickControl("name", mockClickControlBean.Object);
            beanTwo.AddClickControl("name", mockClickControlBean.Object);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container element " +
                "reference and same click control bean instance mapped to the same name");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.ContentContainer = mockContainerElementOne.Object;
            beanTwo.ContentContainer = mockContainerElementOne.Object;

            IClickControlBean clickControlBeanOne = new ClickControlBean();
            IClickControlBean clickControlBeanTwo = new ClickControlBean();

            Mock<IWebElement> mockContainerElementTwo = new Mock<IWebElement>();

            clickControlBeanOne.ContentContainer = mockContainerElementTwo.Object;
            clickControlBeanTwo.ContentContainer = mockContainerElementTwo.Object;
            clickControlBeanOne.ClickWithJavascript = true;
            clickControlBeanTwo.ClickWithJavascript = true;

            beanOne.AddClickControl("name", clickControlBeanOne);
            beanTwo.AddClickControl("name", clickControlBeanTwo);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container element " +
                "reference and different click control bean instance mapped to the same name which have the same " +
                "content container reference and the same non-default Javascript click workaround value");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddClickControl("name", clickControlBeanOne);
            beanTwo.AddClickControl("name", clickControlBeanTwo);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have null container element " +
                "references and different click control bean instances mapped to the same name, but which have " +
                "the same content container reference and the same non-default Javascript click workaround value");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddClickControl("name", mockClickControlBean.Object);
            beanTwo.AddClickControl("name", mockClickControlBean.Object);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have null container element " +
                "references and same click control bean instance mapped to the same name");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.ContentContainer = mockContainerElementOne.Object;
            beanTwo.ContentContainer = mockContainerElementOne.Object;

            Mock<IHoverControlBean> mockHoverControlBean = new Mock<IHoverControlBean>();
            beanOne.AddHoverControl("name", mockHoverControlBean.Object);
            beanTwo.AddHoverControl("name", mockHoverControlBean.Object);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container element " +
                "reference and same hover control bean instance mapped to the same name");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.ContentContainer = mockContainerElementOne.Object;
            beanTwo.ContentContainer = mockContainerElementOne.Object;

            IHoverControlBean hoverControlBeanOne = new HoverControlBean();
            IHoverControlBean hoverControlBeanTwo = new HoverControlBean();

            hoverControlBeanOne.ContentContainer = mockContainerElementTwo.Object;
            hoverControlBeanTwo.ContentContainer = mockContainerElementTwo.Object;
            hoverControlBeanOne.ClickInsteadOfHover = true;
            hoverControlBeanTwo.ClickInsteadOfHover = true;

            beanOne.AddHoverControl("name", hoverControlBeanOne);
            beanTwo.AddHoverControl("name", hoverControlBeanTwo);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container element " +
                "reference and different hover control bean instances mapped to the same name which have the same " +
                "content container reference and the same non-default click instead of hover workaround value");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddHoverControl("name", mockHoverControlBean.Object);
            beanTwo.AddHoverControl("name", mockHoverControlBean.Object);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have null container element " +
                "references and same hover control bean instance mapped to the same name");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.ContentContainer = mockContainerElementOne.Object;
            beanTwo.ContentContainer = mockContainerElementOne.Object;

            Mock<IHoverAndClickControlBean> mockHoverAndClickControlBean = new Mock<IHoverAndClickControlBean>();
            beanOne.AddHoverAndClickControl("name", mockHoverAndClickControlBean.Object);
            beanTwo.AddHoverAndClickControl("name", mockHoverAndClickControlBean.Object);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container element " +
                "reference and same hover and click control bean instance mapped to the same name");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.ContentContainer = mockContainerElementOne.Object;
            beanTwo.ContentContainer = mockContainerElementOne.Object;

            IHoverAndClickControlBean hoverAndClickControlBeanOne = new HoverAndClickControlBean();
            IHoverAndClickControlBean hoverAndClickControlBeanTwo = new HoverAndClickControlBean();

            hoverAndClickControlBeanOne.ContentContainer = mockContainerElementTwo.Object;
            hoverAndClickControlBeanTwo.ContentContainer = mockContainerElementTwo.Object;
            hoverAndClickControlBeanOne.ClickWithJavascript = true;
            hoverAndClickControlBeanTwo.ClickWithJavascript = true;

            beanOne.AddHoverAndClickControl("name", hoverAndClickControlBeanOne);
            beanTwo.AddHoverAndClickControl("name", hoverAndClickControlBeanTwo);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have the same container element " +
                "reference and different hover and click control bean instance mapped to the same name which have " +
                "the same content container reference and the same non-default Javascript click instead of hover " +
                "workaround value");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddHoverAndClickControl("name", mockHoverAndClickControlBean.Object);
            beanTwo.AddHoverAndClickControl("name", mockHoverAndClickControlBean.Object);

            Assert.AreEqual(beanOne, beanTwo, "Two beans should be equal if they have null container element " +
                "references and same hover and click control bean instance mapped to the same name");
        }
        public void HashCodesShouldNotBeEqual()
        {
            Mock<IWebElement> mockElementOne = new Mock<IWebElement>();
            Mock<IWebElement> mockElementTwo = new Mock<IWebElement>();

            IControllableBean beanOne = new ControllableBean();
            IControllableBean beanTwo = new ControllableBean();

            beanOne.ContentContainer = mockElementOne.Object;
            beanTwo.ContentContainer = mockElementTwo.Object;

            Assert.AreNotEqual(beanOne.GetHashCode(), beanTwo.GetHashCode(), "Beans with different container element " +
                "references should have different hash codes");

            beanTwo.ContentContainer = mockElementOne.Object;

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.ContentContainer = mockElementOne.Object;
            beanTwo.ContentContainer = mockElementOne.Object;

            IClickControlBean clickControlBeanOne = new ClickControlBean();
            IClickControlBean clickControlBeanTwo = new ClickControlBean();

            clickControlBeanOne.ContentContainer = mockElementTwo.Object;
            clickControlBeanTwo.ContentContainer = mockElementTwo.Object;
            clickControlBeanOne.ClickWithJavascript = true;

            beanOne.AddClickControl("name", clickControlBeanOne);
            beanTwo.AddClickControl("name", clickControlBeanTwo);

            Assert.AreNotEqual(beanOne.GetHashCode(), beanTwo.GetHashCode(), "Two beans should have difference hash " +
                "codes if they have the same container element reference and different click control bean instance " +
                "mapped to the same name which have the same content container reference but different Javascript " +
                "click workaround values");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddClickControl("clickControlOne", clickControlBeanOne);
            beanTwo.AddClickControl("clickControlTwo", clickControlBeanOne);

            Assert.AreNotEqual(beanOne.GetHashCode(), beanTwo.GetHashCode(), "Beans with the same click control " +
                "bean instance mapped to different names should have different hash codes");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            IHoverControlBean hoverControlBeanOne = new HoverControlBean();
            IHoverControlBean hoverControlBeanTwo = new HoverControlBean();

            hoverControlBeanOne.ContentContainer = mockElementTwo.Object;
            hoverControlBeanTwo.ContentContainer = mockElementTwo.Object;
            hoverControlBeanOne.HoverWithJavascript = true;

            beanOne.AddHoverControl("hoverControl", hoverControlBeanOne);
            beanTwo.AddHoverControl("hoverControl", hoverControlBeanTwo);

            Assert.AreNotEqual(beanOne.GetHashCode(), beanTwo.GetHashCode(), "Two beans should have different hash " +
                "codes  if they have the same container element reference and different hover control bean instance " +
                "mapped to the same name which have the same content container reference but different Javascript " +
                "hover workaround values");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddHoverControl("hoverControlOne", hoverControlBeanOne);
            beanTwo.AddHoverControl("hoverControlTwo", hoverControlBeanOne);

            Assert.AreNotEqual(beanOne.GetHashCode(), beanTwo.GetHashCode(), "Beans with the same hover control bean " +
                "instance mapped to different names should have different hash codes");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            IHoverAndClickControlBean hoverAndClickControlBeanOne = new HoverAndClickControlBean();
            IHoverAndClickControlBean hoverAndClickControlBeanTwo = new HoverAndClickControlBean();

            hoverAndClickControlBeanOne.ContentContainer = mockElementTwo.Object;
            hoverAndClickControlBeanTwo.ContentContainer = mockElementTwo.Object;
            hoverAndClickControlBeanOne.HoverWithJavascript = true;

            beanOne.AddHoverAndClickControl("hoverAndClickControl", hoverAndClickControlBeanOne);
            beanTwo.AddHoverAndClickControl("hoverAndClickControl", hoverAndClickControlBeanTwo);

            Assert.AreNotEqual(beanOne.GetHashCode(), beanTwo.GetHashCode(), "Two beans should have different hash " +
                "codes if they have the same container element reference and different hover and click control bean " +
                "instance mapped to the same name which have the same content container reference but different " +
                "Javascript hover workaround values");

            beanOne = new ControllableBean();
            beanTwo = new ControllableBean();

            beanOne.AddHoverAndClickControl("hoverAndClickControlOne", hoverAndClickControlBeanOne);
            beanTwo.AddHoverAndClickControl("hoverAndClickControlTwo", hoverAndClickControlBeanOne);

            Assert.AreNotEqual(beanOne.GetHashCode(), beanTwo.GetHashCode(), "Beans with the same hover and click " +
                "control bean instance mapped to different names should have different hash codes");
        }