Skip to content

Commit 0f8715f

Browse files
committed
use poly guard
1 parent 49d2a9d commit 0f8715f

File tree

5 files changed

+6
-26
lines changed

5 files changed

+6
-26
lines changed

src/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<NuGetAuditLevel>low</NuGetAuditLevel>
1616
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1717
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
18+
<PolyGuard>true</PolyGuard>
1819
</PropertyGroup>
1920
</Project>

src/SetStartupProjects/Guard.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/SetStartupProjects/SolutionProjectExtractor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public static class SolutionProjectExtractor
77
{
88
public static IEnumerable<Project> GetAllProjectFiles(string solutionFile)
99
{
10-
Guard.AgainstNullAndEmpty(solutionFile, nameof(solutionFile));
10+
Guard.FileExists(solutionFile, nameof(solutionFile));
1111
var solutionDirectory = Path.GetDirectoryName(solutionFile)!;
1212
foreach (var line in File.ReadAllLines(solutionFile))
1313
{

src/SetStartupProjects/StartProjectFinder.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ where ShouldIncludeProjectFile(project)
4949
/// </summary>
5050
public static IEnumerable<string> GetStartProjects(string solutionFile)
5151
{
52-
Guard.AgainstNullAndEmpty(solutionFile, nameof(solutionFile));
53-
Guard.AgainstNonExistingFile(solutionFile, nameof(solutionFile));
52+
Guard.FileExists(solutionFile, nameof(solutionFile));
5453

5554
var nameWithoutExtension = Path.GetFileNameWithoutExtension(solutionFile);
5655
var solutionDirectory = Path.GetDirectoryName(solutionFile)!;
@@ -84,7 +83,7 @@ public static IEnumerable<string> GetStartProjects(string solutionFile)
8483
static bool ShouldIncludeProjectFile(Project project)
8584
{
8685
var projectFile = project.FullPath;
87-
Guard.AgainstNonExistingFile(projectFile, "Project");
86+
Guard.FileExists(projectFile, "Project");
8887
try
8988
{
9089
if (ShouldIncludeForFileExtension(Path.GetExtension(projectFile)))

src/SetStartupProjects/StartProjectSuoCreator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public static class StartProjectSuoCreator
1313
/// </remarks>
1414
public static void CreateForSolutionFile(string solutionFilePath, List<string> startupProjectGuids, VisualStudioVersions visualStudioVersions = VisualStudioVersions.All)
1515
{
16-
Guard.AgainstNullAndEmpty(solutionFilePath, nameof(solutionFilePath));
17-
Guard.AgainstNonExistingFile(solutionFilePath, nameof(solutionFilePath));
16+
Guard.NotNullOrWhiteSpace(solutionFilePath, nameof(solutionFilePath));
17+
Guard.FileExists(solutionFilePath, nameof(solutionFilePath));
1818
if (startupProjectGuids.Count == 0)
1919
{
2020
throw new ArgumentOutOfRangeException(nameof(startupProjectGuids), $"For solutionFilePath: '{solutionFilePath}'");

0 commit comments

Comments
 (0)