Skip to content

Commit

Permalink
Styling consistency (#1072)
Browse files Browse the repository at this point in the history
* whitespace

* xml summary indentation

* remove extra newlines

* use WithMessage extension method
  • Loading branch information
jnyrup authored Jun 4, 2019
1 parent e0af27c commit 1fe7e1b
Show file tree
Hide file tree
Showing 40 changed files with 190 additions and 257 deletions.
13 changes: 6 additions & 7 deletions Src/FluentAssertions/AssertionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,10 @@ public static FunctionAssertions<T> Should<T>(this Func<T> func)
return new FunctionAssertions<T>(func, extractor);
}


#if !NETSTANDARD1_3 && !NETSTANDARD1_6 && !NETSTANDARD2_0

/// <summary>
/// Starts monitoring <paramref name="eventSource"/> for its events.
/// Starts monitoring <paramref name="eventSource"/> for its events.
/// </summary>
/// <param name="eventSource">The object for which to monitor the events.</param>
/// <param name="utcNow">
Expand Down Expand Up @@ -722,17 +721,17 @@ public static TTo As<TTo>(this object subject)
}

/// <summary>
/// Asserts that the thrown exception has a message that matches <paramref name = "expectedWildcardPattern" />.
/// Asserts that the thrown exception has a message that matches <paramref name = "expectedWildcardPattern" />.
/// </summary>
/// <param name = "expectedWildcardPattern">
/// The wildcard pattern with which the exception message is matched, where * and ? have special meanings.
/// The wildcard pattern with which the exception message is matched, where * and ? have special meanings.
/// </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.
/// 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 <see cref = "because" />.
/// Zero or more objects to format using the placeholders in <see cref = "because" />.
/// </param>
public static async Task<ExceptionAssertions<TException>> WithMessage<TException>(
this Task<ExceptionAssertions<TException>> task,
Expand Down
2 changes: 1 addition & 1 deletion Src/FluentAssertions/CallerIdentifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace FluentAssertions
{
/// <summary>
/// Tries to extract the name of the variable or invocation on which the assertion is executed.
/// Tries to extract the name of the variable or invocation on which the assertion is executed.
/// </summary>
public static class CallerIdentifier
{
Expand Down
2 changes: 1 addition & 1 deletion Src/FluentAssertions/Common/ExpressionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static MemberPath GetMemberPath<TDeclaringType, TPropertyType>(
}

// If any members were accessed in the expression, the first one found is the last member.
Type declaringType = declaringTypes.FirstOrDefault( ) ?? typeof(TDeclaringType);
Type declaringType = declaringTypes.FirstOrDefault() ?? typeof(TDeclaringType);

string[] reversedSegments = segments.AsEnumerable().Reverse().ToArray();
string segmentPath = string.Join(".", reversedSegments);
Expand Down
22 changes: 11 additions & 11 deletions Src/FluentAssertions/Common/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public static class TypeExtensions
PublicMembersFlag | BindingFlags.NonPublic | BindingFlags.Static;

/// <summary>
/// Determines whether the specified method has been annotated with a specific attribute.
/// Determines whether the specified method has been annotated with a specific attribute.
/// </summary>
/// <returns>
/// <c>true</c> if the specified method has attribute; otherwise, <c>false</c>.
/// <c>true</c> if the specified method has attribute; otherwise, <c>false</c>.
/// </returns>
public static bool HasAttribute<TAttribute>(this MemberInfo method)
where TAttribute : Attribute
Expand Down Expand Up @@ -77,8 +77,8 @@ private static IEnumerable<TAttribute> GetCustomAttributes<TAttribute>(TypeInfo
}

/// <summary>
/// Determines whether two <see cref="FluentAssertions.Equivalency.SelectedMemberInfo" /> objects refer to the same
/// member.
/// Determines whether two <see cref="FluentAssertions.Equivalency.SelectedMemberInfo" /> objects refer to the same
/// member.
/// </summary>
public static bool IsEquivalentTo(this SelectedMemberInfo property, SelectedMemberInfo otherProperty)
{
Expand All @@ -94,7 +94,7 @@ public static bool IsSameOrInherits(this Type actualType, Type expectedType)
}

/// <summary>
/// NOTE: This method does not give the expected results with open generics
/// NOTE: This method does not give the expected results with open generics
/// </summary>
public static bool Implements(this Type type, Type expectedBaseType)
{
Expand Down Expand Up @@ -136,10 +136,10 @@ public static bool OverridesEquals(this Type type)
}

/// <summary>
/// Finds a member by its case-sensitive name.
/// Finds a member by its case-sensitive name.
/// </summary>
/// <returns>
/// Returns <c>null</c> if no such member exists.
/// Returns <c>null</c> if no such member exists.
/// </returns>
public static SelectedMemberInfo FindMember(this Type type, string memberName, Type preferredType)
{
Expand All @@ -148,10 +148,10 @@ public static SelectedMemberInfo FindMember(this Type type, string memberName, T
}

/// <summary>
/// Finds the property by a case-sensitive name.
/// Finds the property by a case-sensitive name.
/// </summary>
/// <returns>
/// Returns <c>null</c> if no such property exists.
/// Returns <c>null</c> if no such property exists.
/// </returns>
public static PropertyInfo FindProperty(this Type type, string propertyName, Type preferredType)
{
Expand All @@ -166,10 +166,10 @@ public static PropertyInfo FindProperty(this Type type, string propertyName, Typ
}

/// <summary>
/// Finds the field by a case-sensitive name.
/// Finds the field by a case-sensitive name.
/// </summary>
/// <returns>
/// Returns <c>null</c> if no such property exists.
/// Returns <c>null</c> if no such property exists.
/// </returns>
public static FieldInfo FindField(this Type type, string fieldName, Type preferredType)
{
Expand Down
4 changes: 2 additions & 2 deletions Src/FluentAssertions/Equivalency/AssertionResultSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class AssertionResultSet

/// <summary>
/// Adds the failures (if any) resulting from executing an assertion within a
/// <see cref="AssertionScope"/> identified by a key.
/// <see cref="AssertionScope"/> identified by a key.
/// </summary>
public void AddSet(object key, string[] failures)
{
Expand All @@ -25,7 +25,7 @@ public void AddSet(object key, string[] failures)
/// an empty array if one of the results represents a successful assertion.
/// </summary>
/// <remarks>
/// The closest match is the set that contains the least amount of failures, or no failures at all, and preferably
/// The closest match is the set that contains the least amount of failures, or no failures at all, and preferably
/// the set that is identified by the <paramref name="key"/>.
/// </remarks>
public string[] SelectClosestMatchFor(object key = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace FluentAssertions.Equivalency
public static class EquivalencyAssertionOptionsExtentions
{
/// <summary>
/// Returns either the run-time or compile-time type of the subject based on the options provided by the caller.
/// Returns either the run-time or compile-time type of the subject based on the options provided by the caller.
/// </summary>
/// <remarks>
/// If the expectation is a nullable type, it should return the type of the wrapped object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ public EquivalencyValidationContext()
public object Expectation { get; set; }

/// <summary>
/// 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.
/// 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.
/// </summary>
public string Because { get; set; }

/// <summary>
/// Zero or more objects to format using the placeholders in <see cref="IEquivalencyValidationContext.Because" />.
/// Zero or more objects to format using the placeholders in <see cref="IEquivalencyValidationContext.Because" />.
/// </summary>
public object[] BecauseArgs { get; set; }

/// <summary>
/// Gets a value indicating whether the current context represents the root of the object graph.
/// Gets a value indicating whether the current context represents the root of the object graph.
/// </summary>
public bool IsRoot
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
namespace FluentAssertions.Equivalency
{
/// <remarks>
/// I think (but did not try) this would have been easier using 'dynamic' but that is
/// precluded by some of the PCL targets.
/// I think (but did not try) this would have been easier using 'dynamic' but that is
/// precluded by some of the PCL targets.
/// </remarks>
public class GenericDictionaryEquivalencyStep : IEquivalencyStep
{
Expand Down Expand Up @@ -140,7 +140,7 @@ private static Type GetDictionaryKeyType(Type expectedType)

private static bool AssertSameLength(object subject, Type expectationType, object expectation)
{
if(subject is ICollection subjectCollection
if (subject is ICollection subjectCollection
&& expectation is ICollection expectationCollection
&& subjectCollection.Count == expectationCollection.Count)
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static bool AssertSubjectIsCollection(object expectation, object subject
{
bool conditionMet = AssertionScope.Current
.ForCondition(!(subject is null))
.FailWith("Expected {context:subject} not to be {0}.", new object[] {null});
.FailWith("Expected {context:subject} not to be {0}.", new object[] { null });

if (conditionMet)
{
Expand Down
2 changes: 1 addition & 1 deletion Src/FluentAssertions/Equivalency/IMemberSelectionRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface IMemberSelectionRule
/// comparing two objects for structural equality.
/// </summary>
/// <param name="selectedMembers">
/// A collection of members that was prepopulated by other selection rules. Can be empty.</param>
/// A collection of members that was prepopulated by other selection rules. Can be empty.</param>
/// <param name="context"></param>
/// <param name="config"></param>
/// <param name="info">
Expand Down
Loading

0 comments on commit 1fe7e1b

Please sign in to comment.