Exemplo n.º 1
0
        /// <summary>
        /// Asserts that the current <see cref="XDocument"/> is not equivalent to the <paramref name="unexpected"/> document,
        /// using its <see cref="XNode.DeepEquals()" /> implementation.
        /// </summary>
        /// <param name="unexpected">The unexpected document</param>
        /// <param name="reason">
        /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
        /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
        /// </param>
        /// <param name="reasonArgs">
        /// Zero or more objects to format using the placeholders in <see cref="reason" />.
        /// </param>
        public static AndConstraint <XDocumentAssertions> NotBeEquivalentTo(this XDocumentAssertions @this, XDocument unexpected, string reason, params object[] reasonArgs)
        {
            Execute.Assertion
            .ForCondition(!XNode.DeepEquals(@this.Subject, unexpected))
            .BecauseOf(reason, reasonArgs)
            .FailWith("Did not expect XML document {0} to be equivalent to {1}{reason}.",
                      @this.Subject, unexpected);

            return(new AndConstraint <XDocumentAssertions>(@this));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Asserts that the current <see cref="XDocument"/> is not equivalent to the <paramref name="unexpected"/> document,
 /// using its <see cref="XNode.DeepEquals()" /> implementation.
 /// </summary>
 /// <param name="unexpected">The unexpected document</param>
 public static AndConstraint <XDocumentAssertions> NotBeEquivalentTo(this XDocumentAssertions @this, XDocument unexpected)
 {
     return(@this.NotBeEquivalentTo(unexpected, string.Empty));
 }