/// <summary> /// Asserts that the current <see cref="XElement"/> is not equivalent to the <paramref name="unexpected"/> element, /// using its <see cref="XNode.DeepEquals()" /> implementation. /// </summary> /// <param name="unexpected">The unexpected element</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 <XElementAssertions> NotBeEquivalentTo(this XElementAssertions @this, XElement unexpected, string reason, params object[] reasonArgs) { Execute.Assertion .ForCondition(!XNode.DeepEquals(@this.Subject, unexpected)) .BecauseOf(reason, reasonArgs) .FailWith("Did not expect XML element {0} to be equivalent to {1}{reason}.", @this.Subject, unexpected); return(new AndConstraint <XElementAssertions>(@this)); }
/// <summary> /// Asserts that the current <see cref="XElement"/> is not equivalent to the <paramref name="unexpected"/> element, /// using its <see cref="XNode.DeepEquals()" /> implementation. /// </summary> /// <param name="unexpected">The unexpected element</param> public static AndConstraint <XElementAssertions> NotBeEquivalentTo(this XElementAssertions @this, XElement unexpected) { return(@this.NotBeEquivalentTo(unexpected, string.Empty)); }