Skip to content

Commit

Permalink
Remove HaveSingleElement because it is redundant and less fluent
Browse files Browse the repository at this point in the history
  • Loading branch information
ITaluone committed Apr 19, 2022
1 parent c242253 commit dbce69d
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 16,514 deletions.
38 changes: 0 additions & 38 deletions Src/FluentAssertions/Xml/XDocumentAssertions.cs
Expand Up @@ -265,44 +265,6 @@ public AndConstraint<XDocumentAssertions> NotBeEquivalentTo(XDocument unexpected
return new AndWhichConstraint<XDocumentAssertions, XElement>(this, xElement);
}

/// <summary>
/// Asserts that the <see cref="XDocument.Root"/> element of the current <see cref="XDocument"/> has a <i>single</i>
/// child element with the specified <paramref name="expected"/> name.
/// </summary>
/// <param name="expected">
/// The full name <see cref="XName"/> of the expected child element of the current document's <see cref="XDocument.Root"/> element.
/// </param>
/// <param name="because">
/// 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="becauseArgs">
/// Zero or more objects to format using the placeholders in <paramref name="because" />.
/// </param>
public AndWhichConstraint<XDocumentAssertions, XElement> HaveSingleElement(XName expected, string because = "", params object[] becauseArgs)
{
return HaveElement(expected, Exactly.Once(), because, becauseArgs);
}

/// <summary>
/// Asserts that the <see cref="XDocument.Root"/> element of the current <see cref="XDocument"/> has a <i>single</i>
/// child element with the specified <paramref name="expected"/> name.
/// </summary>
/// <param name="expected">
/// The full name of the expected child element of the current document's <see cref="XDocument.Root"/> element.
/// </param>
/// <param name="because">
/// 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="becauseArgs">
/// Zero or more objects to format using the placeholders in <paramref name="because" />.
/// </param>
public AndWhichConstraint<XDocumentAssertions, XElement> HaveSingleElement(string expected, string because = "", params object[] becauseArgs)
{
return HaveElement(XNamespace.None + expected, Exactly.Once(), because, becauseArgs);
}

/// <summary>
/// Asserts that the <see cref="XDocument.Root"/> element of the current <see cref="XDocument"/> has the specified occurrence of
/// child elements with the specified <paramref name="expected"/> name.
Expand Down
38 changes: 0 additions & 38 deletions Src/FluentAssertions/Xml/XElementAssertions.cs
Expand Up @@ -290,44 +290,6 @@ public AndConstraint<XElementAssertions> HaveValue(string expected, string becau
return new AndWhichConstraint<XElementAssertions, XElement>(this, xElement);
}

/// <summary>
/// Asserts that the <see cref="XElement"/> of the current <see cref="XElement"/> has a <i>single</i>
/// child element with the specified <paramref name="expected"/> name.
/// </summary>
/// <param name="expected">
/// The full name <see cref="XName"/> of the expected child element of the current element's <see cref="XElement"/>.
/// </param>
/// <param name="because">
/// 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="becauseArgs">
/// Zero or more objects to format using the placeholders in <paramref name="because" />.
/// </param>
public AndWhichConstraint<XElementAssertions, XElement> HaveSingleElement(XName expected, string because = "", params object[] becauseArgs)
{
return HaveElement(expected, Exactly.Once(), because, becauseArgs);
}

/// <summary>
/// Asserts that the <see cref="XElement"/> of the current <see cref="XElement"/> has a <i>single</i>
/// child element with the specified <paramref name="expected"/> name.
/// </summary>
/// <param name="expected">
/// The full name of the expected child element of the current element's <see cref="XElement"/>.
/// </param>
/// <param name="because">
/// 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="becauseArgs">
/// Zero or more objects to format using the placeholders in <paramref name="because" />.
/// </param>
public AndWhichConstraint<XElementAssertions, XElement> HaveSingleElement(string expected, string because = "", params object[] becauseArgs)
{
return HaveElement(XNamespace.None + expected, Exactly.Once(), because, becauseArgs);
}

/// <summary>
/// Asserts that the <see cref="XElement"/> of the current <see cref="XElement"/> has the specified occurrence of
/// child elements with the specified <paramref name="expected"/> name.
Expand Down

0 comments on commit dbce69d

Please sign in to comment.