Ejemplo n.º 1
0
 public void TestInequalityOfUsing()
 {
     FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Hello" };
     FindsByAttribute second = new FindsByAttribute() { How = How.Id, Using = "World" };
     Assert.IsFalse(first.Equals(second));
     Assert.IsFalse(first == second);
     Assert.IsTrue(first != second);
 }
Ejemplo n.º 2
0
 public void TestInequalityOfPriority()
 {
     FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Test", Priority = 1 };
     FindsByAttribute second = new FindsByAttribute() { How = How.Id, Using = "Test", Priority = 2 };
     Assert.IsFalse(first.Equals(second));
     Assert.IsFalse(first == second);
     Assert.IsTrue(first != second);
 }
Ejemplo n.º 3
0
 public void TestEquality()
 {
     FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Test" };
     FindsByAttribute second = new FindsByAttribute() { How = How.Id, Using = "Test" };
     Assert.IsTrue(first.Equals(second));
     Assert.IsFalse(object.ReferenceEquals(first, second));
     Assert.IsTrue(first == second);
     Assert.IsFalse(first != second);
 }
Ejemplo n.º 4
0
 public void TestSameInstanceEquality()
 {
     FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Test" };
     FindsByAttribute second = first;
     Assert.IsTrue(first == second);
     Assert.IsTrue(second == first);
     Assert.IsTrue(first.Equals(second));
     Assert.IsTrue(second.Equals(first));
     Assert.IsTrue(object.ReferenceEquals(first, second));
 }
Ejemplo n.º 5
0
        public void TestInequalityOfNull()
        {
            FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Test" };
            FindsByAttribute second = null;
            Assert.IsFalse(first.Equals(second));

            // Must test order of arguments for overridden operators
            Assert.IsFalse(first == second);
            Assert.IsTrue(first != second);
            Assert.IsFalse(second == first);
            Assert.IsTrue(second != first);
        }
Ejemplo n.º 6
0
        public void TestEqualityOfFinder()
        {
            By findBy = By.Id("Test");
            FindsByAttribute first = new FindsByAttribute() { Finder = findBy };

            // Use different instance of By class.
            FindsByAttribute second = new FindsByAttribute() { Finder = By.Id("Test") };
            Assert.IsTrue(first == second);
            Assert.IsTrue(second == first);
            Assert.IsFalse(first != second);
            Assert.IsFalse(second != first);
            Assert.IsTrue(first.Equals(second));

            // Use same instance of By class.
            second.Finder = findBy;
            Assert.IsTrue(first == second);
            Assert.IsTrue(second == first);
            Assert.IsFalse(first != second);
            Assert.IsFalse(second != first);
            Assert.IsTrue(first.Equals(second));
        }
Ejemplo n.º 7
0
        public void TestSameInstanceEquality()
        {
            FindsByAttribute first = new FindsByAttribute()
            {
                How = How.Id, Using = "Test"
            };
            FindsByAttribute second = first;

            Assert.IsTrue(first == second);
            Assert.IsTrue(second == first);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(second.Equals(first));
            Assert.IsTrue(object.ReferenceEquals(first, second));
        }
Ejemplo n.º 8
0
        public void TestInequalityOfPriority()
        {
            FindsByAttribute first = new FindsByAttribute()
            {
                How = How.Id, Using = "Test", Priority = 1
            };
            FindsByAttribute second = new FindsByAttribute()
            {
                How = How.Id, Using = "Test", Priority = 2
            };

            Assert.IsFalse(first.Equals(second));
            Assert.IsFalse(first == second);
            Assert.IsTrue(first != second);
        }
Ejemplo n.º 9
0
        public void TestInequalityOfUsing()
        {
            FindsByAttribute first = new FindsByAttribute()
            {
                How = How.Id, Using = "Hello"
            };
            FindsByAttribute second = new FindsByAttribute()
            {
                How = How.Id, Using = "World"
            };

            Assert.IsFalse(first.Equals(second));
            Assert.IsFalse(first == second);
            Assert.IsTrue(first != second);
        }
Ejemplo n.º 10
0
        public void TestInequalityOfNull()
        {
            FindsByAttribute first = new FindsByAttribute()
            {
                How = How.Id, Using = "Test"
            };
            FindsByAttribute second = null;

            Assert.IsFalse(first.Equals(second));

            // Must test order of arguments for overridden operators
            Assert.IsFalse(first == second);
            Assert.IsTrue(first != second);
            Assert.IsFalse(second == first);
            Assert.IsTrue(second != first);
        }
Ejemplo n.º 11
0
        public void TestEquality()
        {
            FindsByAttribute first = new FindsByAttribute()
            {
                How = How.Id, Using = "Test"
            };
            FindsByAttribute second = new FindsByAttribute()
            {
                How = How.Id, Using = "Test"
            };

            Assert.IsTrue(first.Equals(second));
            Assert.IsFalse(object.ReferenceEquals(first, second));
            Assert.IsTrue(first == second);
            Assert.IsFalse(first != second);
        }
Ejemplo n.º 12
0
 public void TestInqualityOfFinder()
 {
     FindsByAttribute first = new FindsByAttribute() { Finder = By.Id("Test") };
     FindsByAttribute second = new FindsByAttribute() { Finder = By.Name("Test") };
     Assert.IsFalse(first == second);
     Assert.IsFalse(second == first);
     Assert.IsFalse(first.Equals(second));
 }