Skip to content

Commit

Permalink
Add Resharper snippets for expanding contract Fail checks #17
Browse files Browse the repository at this point in the history
- added snippet argument.fiaw expandable to Fail.IfArgumentWhiteSpace(argument, nameof(argument));
  • Loading branch information
MarcinCelej committed Oct 13, 2016
1 parent 3ac120c commit 7816d24
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Synergy.Contracts/Failures/FailNullability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ [CanBeNull] [AssertionCondition(AssertionConditionType.IS_NOT_NULL)] object argu
}

/// <summary>
/// Template for expanding Fail.IfArgumentNull(argument, nameof(argument));
/// Template for expanding <c>Fail.IfArgumentNull(argument, nameof(argument));</c>
/// Type <c>argument.fian</c> and press TAB and let Resharper complete the template.
/// </summary>
/// <param name="argumentValue">Value of the argument to check against being <see langword="null" />.</param>
Expand Down
15 changes: 14 additions & 1 deletion Synergy.Contracts/Failures/FailString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void IfArgumentEmpty(
}

/// <summary>
/// Template for expanding Fail.IfArgumentEmpty(argument, nameof(argument));
/// Template for expanding <c>Fail.IfArgumentEmpty(argument, nameof(argument));</c>
/// Type <c>argument.fiae</c> and press TAB and let Resharper complete the template.
/// </summary>
/// <param name="argumentValue">Value of the argument to check against <see langword="null"/> or emptiness.</param>
Expand Down Expand Up @@ -79,6 +79,19 @@ public static void IfArgumentWhiteSpace(
throw Fail.Because("Argument '{0}' was empty.", argumentName);
}

/// <summary>
/// Template for expanding <c>Fail.IfArgumentWhiteSpace(argument, nameof(argument));</c>
/// Type <c>argument.fiaw</c> and press TAB and let Resharper complete the template.
/// </summary>
/// <param name="argumentValue">Value of the argument to check.</param>
[SourceTemplate]
[UsedImplicitly]
// ReSharper disable once InconsistentNaming
public static void fiaw([CanBeNull] this string argumentValue)
{
Fail.IfArgumentWhiteSpace(argumentValue, nameof(argumentValue));
}

/// <summary>
/// Throws exception if the specified value is <see langword="null"/> or white space.
/// </summary>
Expand Down

0 comments on commit 7816d24

Please sign in to comment.