Skip to content

Commit

Permalink
leverage out null pattern in IsValidDeploymentItem (#4048)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Dec 9, 2024
1 parent fcee02a commit 881b5e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ internal IList<DeploymentItem> GetClassLevelDeploymentItems(Type type, ICollecti
/// <param name="warning"> The warning message if it is an invalid deployment item. </param>
/// <returns> Returns true if it is a valid deployment item. </returns>
[SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "2#", Justification = "Internal method.")]
internal static bool IsValidDeploymentItem([NotNullWhen(true)] string? sourcePath, [NotNullWhen(true)] string? relativeOutputDirectory, out string warning)
internal static bool IsValidDeploymentItem([NotNullWhen(true)] string? sourcePath, [NotNullWhen(true)] string? relativeOutputDirectory, [NotNullWhen(false)] out string? warning)
{
if (StringEx.IsNullOrEmpty(sourcePath))
{
Expand All @@ -105,7 +105,7 @@ internal static bool IsValidDeploymentItem([NotNullWhen(true)] string? sourcePat
return false;
}

warning = string.Empty;
warning = null;
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public void IsValidDeploymentItemShouldReturnTrueForAValidDeploymentItem()
{
Verify(DeploymentItemUtility.IsValidDeploymentItem(_defaultDeploymentItemPath, _defaultDeploymentItemOutputDirectory, out string warning));

Verify(string.Empty.Equals(warning, StringComparison.Ordinal));
Verify(warning is null);
}
#endregion

Expand Down

0 comments on commit 881b5e6

Please sign in to comment.