Skip to content

Commit

Permalink
Replace argument checks with Requires.NotNull() / Requires.NotNullOrW…
Browse files Browse the repository at this point in the history
…hiteSpace()
  • Loading branch information
ap0llo committed May 29, 2020
1 parent c3bff85 commit fab0e06
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/NerdBank.GitVersioning/ReleaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ public ReleaseInfo(ReleaseBranchInfo currentBranch) : this(currentBranch, null)
[JsonConstructor]
public ReleaseInfo(ReleaseBranchInfo currentBranch, ReleaseBranchInfo newBranch)
{
if(currentBranch == null)
{
throw new ArgumentNullException(nameof(currentBranch), $"{nameof(this.CurrentBranch)} can't be empty");
}

Requires.NotNull(currentBranch, nameof(currentBranch));
// skip null check for newBranch, it is allowed to be null.

this.CurrentBranch = currentBranch;
Expand Down Expand Up @@ -155,20 +151,9 @@ public class ReleaseBranchInfo
/// <param name="version">The version configured in the branch's <c>version.json</c>.</param>
public ReleaseBranchInfo(string name, string commit, SemanticVersion version)
{
if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentNullException(nameof(name), $"{nameof(this.Name)} can't be empty");
}

if (string.IsNullOrWhiteSpace(commit))
{
throw new ArgumentNullException(nameof(commit), $"{nameof(this.Commit)} can't be empty");
}

if(version == null)
{
throw new ArgumentNullException(nameof(version), $"{nameof(this.Version)} can't be empty");
}
Requires.NotNullOrWhiteSpace(name, nameof(name));
Requires.NotNullOrWhiteSpace(commit, nameof(commit));
Requires.NotNull(version, nameof(version));

this.Name = name;
this.Commit = commit;
Expand Down

0 comments on commit fab0e06

Please sign in to comment.