Exemplo n.º 1
0
        private static void AssertUrlValue(AttributeConstraint value)
        {
            Assert.AreEqual(Href, value.AttributeName, "Wrong attributename");
            Assert.That(value.Comparer.ToString(), Text.Contains("'" + WatiNURI.AbsoluteUri + "'"), "Wrong value");

            var mockAttributeBag = new MockAttributeBag(Href, WatiNURI.AbsoluteUri);
            var context          = new ConstraintContext();

            Assert.IsTrue(value.Matches(mockAttributeBag, context), "Should match WatiN url");

            mockAttributeBag = new MockAttributeBag(Href, "http://www.microsoft.com");
            Assert.IsFalse(value.Matches(mockAttributeBag, context), "Shouldn't match Microsoft");

            mockAttributeBag = new MockAttributeBag(Href, null);
            Assert.IsFalse(value.Matches(mockAttributeBag, context), "Null should not match");

            mockAttributeBag = new MockAttributeBag(Href, String.Empty);
            Assert.IsFalse(value.Matches(mockAttributeBag, context), "Null should not match");
        }