Skip to content

Commit

Permalink
Merge pull request #1777 from jnyrup/Identifier
Browse files Browse the repository at this point in the history
Adjust Identifier properties
  • Loading branch information
jnyrup committed Jan 16, 2022
2 parents adedaf9 + 4eacf0d commit e0d8e8b
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 8 deletions.
Expand Up @@ -230,5 +230,7 @@ public AndConstraint<TAssertions> NotHaveStatusCode(HttpStatusCode unexpected, s
private bool IsServerError() => (int)Subject.StatusCode is >= 500 and <= 599;

private bool IsClientError() => (int)Subject.StatusCode is >= 400 and <= 499;

protected override string Identifier => "HTTP response message";
}
}
1 change: 1 addition & 0 deletions Src/FluentAssertions/Primitives/ReferenceTypeAssertions.cs
Expand Up @@ -416,6 +416,7 @@ public AndConstraint<TAssertions> NotBeAssignableTo(Type type, string because =

/// <summary>
/// Returns the type of the subject the assertion applies on.
/// It should be a user-friendly name as it is included in the failure message.
/// </summary>
protected abstract string Identifier { get; }

Expand Down
2 changes: 0 additions & 2 deletions Src/FluentAssertions/Types/MethodBaseAssertions.cs
Expand Up @@ -93,8 +93,6 @@ public AndConstraint<TAssertions> NotHaveAccessModifier(CSharpAccessModifier acc
return new AndConstraint<TAssertions>((TAssertions)this);
}

protected override string Identifier => "methodBase";

internal static string GetParameterString(MethodBase methodBase)
{
IEnumerable<Type> parameterTypes = methodBase.GetParameters().Select(p => p.ParameterType);
Expand Down
2 changes: 2 additions & 0 deletions Src/FluentAssertions/Xml/XmlElementAssertions.cs
Expand Up @@ -165,5 +165,7 @@ public XmlElementAssertions(XmlElement xmlElement)

return new AndWhichConstraint<XmlElementAssertions, XmlElement>(this, element);
}

protected override string Identifier => "XML element";
}
}
2 changes: 1 addition & 1 deletion Src/FluentAssertions/Xml/XmlNodeAssertions.cs
Expand Up @@ -80,6 +80,6 @@ public AndConstraint<TAssertions> NotBeEquivalentTo(XmlNode unexpected, string b
/// <summary>
/// Returns the type of the subject the assertion applies on.
/// </summary>
protected override string Identifier => "Xml Node";
protected override string Identifier => "XML node";
}
}
Expand Up @@ -1922,6 +1922,7 @@ namespace FluentAssertions.Primitives
where TAssertions : FluentAssertions.Primitives.HttpResponseMessageAssertions<TAssertions>
{
protected HttpResponseMessageAssertions(System.Net.Http.HttpResponseMessage value) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> BeRedirection(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeSuccessful(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> HaveClientError(string because = "", params object[] becauseArgs) { }
Expand Down Expand Up @@ -2348,7 +2349,6 @@ namespace FluentAssertions.Types
where TAssertions : FluentAssertions.Types.MethodBaseAssertions<TSubject, TAssertions>
{
protected MethodBaseAssertions(TSubject subject) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> HaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
}
Expand Down Expand Up @@ -2645,6 +2645,7 @@ namespace FluentAssertions.Xml
public class XmlElementAssertions : FluentAssertions.Xml.XmlNodeAssertions<System.Xml.XmlElement, FluentAssertions.Xml.XmlElementAssertions>
{
public XmlElementAssertions(System.Xml.XmlElement xmlElement) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttribute(string expectedName, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttributeWithNamespace(string expectedName, string expectedNamespace, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndWhichConstraint<FluentAssertions.Xml.XmlElementAssertions, System.Xml.XmlElement> HaveElement(string expectedName, string because = "", params object[] becauseArgs) { }
Expand Down
Expand Up @@ -1922,6 +1922,7 @@ namespace FluentAssertions.Primitives
where TAssertions : FluentAssertions.Primitives.HttpResponseMessageAssertions<TAssertions>
{
protected HttpResponseMessageAssertions(System.Net.Http.HttpResponseMessage value) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> BeRedirection(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeSuccessful(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> HaveClientError(string because = "", params object[] becauseArgs) { }
Expand Down Expand Up @@ -2350,7 +2351,6 @@ namespace FluentAssertions.Types
where TAssertions : FluentAssertions.Types.MethodBaseAssertions<TSubject, TAssertions>
{
protected MethodBaseAssertions(TSubject subject) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> HaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
}
Expand Down Expand Up @@ -2647,6 +2647,7 @@ namespace FluentAssertions.Xml
public class XmlElementAssertions : FluentAssertions.Xml.XmlNodeAssertions<System.Xml.XmlElement, FluentAssertions.Xml.XmlElementAssertions>
{
public XmlElementAssertions(System.Xml.XmlElement xmlElement) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttribute(string expectedName, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttributeWithNamespace(string expectedName, string expectedNamespace, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndWhichConstraint<FluentAssertions.Xml.XmlElementAssertions, System.Xml.XmlElement> HaveElement(string expectedName, string because = "", params object[] becauseArgs) { }
Expand Down
Expand Up @@ -1922,6 +1922,7 @@ namespace FluentAssertions.Primitives
where TAssertions : FluentAssertions.Primitives.HttpResponseMessageAssertions<TAssertions>
{
protected HttpResponseMessageAssertions(System.Net.Http.HttpResponseMessage value) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> BeRedirection(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeSuccessful(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> HaveClientError(string because = "", params object[] becauseArgs) { }
Expand Down Expand Up @@ -2350,7 +2351,6 @@ namespace FluentAssertions.Types
where TAssertions : FluentAssertions.Types.MethodBaseAssertions<TSubject, TAssertions>
{
protected MethodBaseAssertions(TSubject subject) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> HaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
}
Expand Down Expand Up @@ -2647,6 +2647,7 @@ namespace FluentAssertions.Xml
public class XmlElementAssertions : FluentAssertions.Xml.XmlNodeAssertions<System.Xml.XmlElement, FluentAssertions.Xml.XmlElementAssertions>
{
public XmlElementAssertions(System.Xml.XmlElement xmlElement) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttribute(string expectedName, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttributeWithNamespace(string expectedName, string expectedNamespace, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndWhichConstraint<FluentAssertions.Xml.XmlElementAssertions, System.Xml.XmlElement> HaveElement(string expectedName, string because = "", params object[] becauseArgs) { }
Expand Down
Expand Up @@ -1875,6 +1875,7 @@ namespace FluentAssertions.Primitives
where TAssertions : FluentAssertions.Primitives.HttpResponseMessageAssertions<TAssertions>
{
protected HttpResponseMessageAssertions(System.Net.Http.HttpResponseMessage value) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> BeRedirection(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeSuccessful(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> HaveClientError(string because = "", params object[] becauseArgs) { }
Expand Down Expand Up @@ -2301,7 +2302,6 @@ namespace FluentAssertions.Types
where TAssertions : FluentAssertions.Types.MethodBaseAssertions<TSubject, TAssertions>
{
protected MethodBaseAssertions(TSubject subject) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> HaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
}
Expand Down Expand Up @@ -2598,6 +2598,7 @@ namespace FluentAssertions.Xml
public class XmlElementAssertions : FluentAssertions.Xml.XmlNodeAssertions<System.Xml.XmlElement, FluentAssertions.Xml.XmlElementAssertions>
{
public XmlElementAssertions(System.Xml.XmlElement xmlElement) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttribute(string expectedName, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttributeWithNamespace(string expectedName, string expectedNamespace, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndWhichConstraint<FluentAssertions.Xml.XmlElementAssertions, System.Xml.XmlElement> HaveElement(string expectedName, string because = "", params object[] becauseArgs) { }
Expand Down
Expand Up @@ -1922,6 +1922,7 @@ namespace FluentAssertions.Primitives
where TAssertions : FluentAssertions.Primitives.HttpResponseMessageAssertions<TAssertions>
{
protected HttpResponseMessageAssertions(System.Net.Http.HttpResponseMessage value) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> BeRedirection(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeSuccessful(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> HaveClientError(string because = "", params object[] becauseArgs) { }
Expand Down Expand Up @@ -2350,7 +2351,6 @@ namespace FluentAssertions.Types
where TAssertions : FluentAssertions.Types.MethodBaseAssertions<TSubject, TAssertions>
{
protected MethodBaseAssertions(TSubject subject) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<TAssertions> HaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveAccessModifier(FluentAssertions.Common.CSharpAccessModifier accessModifier, string because = "", params object[] becauseArgs) { }
}
Expand Down Expand Up @@ -2647,6 +2647,7 @@ namespace FluentAssertions.Xml
public class XmlElementAssertions : FluentAssertions.Xml.XmlNodeAssertions<System.Xml.XmlElement, FluentAssertions.Xml.XmlElementAssertions>
{
public XmlElementAssertions(System.Xml.XmlElement xmlElement) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttribute(string expectedName, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<FluentAssertions.Xml.XmlElementAssertions> HaveAttributeWithNamespace(string expectedName, string expectedNamespace, string expectedValue, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndWhichConstraint<FluentAssertions.Xml.XmlElementAssertions, System.Xml.XmlElement> HaveElement(string expectedName, string because = "", params object[] becauseArgs) { }
Expand Down

0 comments on commit e0d8e8b

Please sign in to comment.