Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove Validate and use Guard #3838

Merged
merged 7 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ public static string GetTestResultsDirectory(IRunContext? runContext) => !String
/// <returns>Returns a list of deployment warnings.</returns>
protected IEnumerable<string> Deploy(IList<DeploymentItem> deploymentItems, string testSource, string deploymentDirectory, string resultsDirectory)
{
Validate.IsFalse(StringEx.IsNullOrWhiteSpace(deploymentDirectory), "Deployment directory is null or empty");
Validate.IsTrue(FileUtility.DoesDirectoryExist(deploymentDirectory), $"Deployment directory {deploymentDirectory} does not exist");
Validate.IsFalse(StringEx.IsNullOrWhiteSpace(testSource), "TestSource directory is null/empty");
Validate.IsTrue(FileUtility.DoesFileExist(testSource), $"TestSource {testSource} does not exist.");
Guard.NotNullOrWhiteSpace(deploymentDirectory);
Guard.NotNullOrWhiteSpace(testSource);
ApplicationStateGuard.Ensure(FileUtility.DoesDirectoryExist(deploymentDirectory), $"Deployment directory {deploymentDirectory} does not exist");
ApplicationStateGuard.Ensure(FileUtility.DoesFileExist(testSource), $"TestSource {testSource} does not exist.");

testSource = Path.GetFullPath(testSource);
var warnings = new List<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static string TryConvertPathToRelative(string path, string rootDir)
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
public virtual void DeleteDirectories(string filePath)
{
Validate.IsFalse(StringEx.IsNullOrWhiteSpace(filePath), "Invalid filePath provided");
Guard.NotNullOrWhiteSpace(filePath);
try
{
var root = new DirectoryInfo(filePath);
Expand Down
40 changes: 0 additions & 40 deletions src/Adapter/MSTestAdapter.PlatformServices/Utilities/Validate.cs

This file was deleted.