/// <summary>
        /// Asserts that an element should exist at least once
        /// </summary>
        public static AndConnector <QueryWrapper> ShouldExist(this QueryWrapper query)
        {
            if (!query.Any())
            {
                throw new AssertException("The selector did not match any elements in the document.");
            }

            return(new AndConnector <QueryWrapper>(query));
        }
        /// <summary>
        /// Asserts that an element does not exist
        /// </summary>
        public static AndConnector <QueryWrapper> ShouldNotExist(this QueryWrapper query)
        {
            if (query.Any())
            {
                var message = string.Format("The selector matched {0} element(s) in the document.", query.Count());
                throw new AssertException(message);
            }

            return(new AndConnector <QueryWrapper>(query));
        }
Example #3
0
        /// <summary>
        /// Asserts that an element should exist at least once
        /// </summary>
        public static AndConnector <QueryWrapper> ShouldExist(this QueryWrapper query)
        {
            Assert.True(query.Any());

            return(new AndConnector <QueryWrapper>(query));
        }