-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: validate
--SourceDirectory
(#805)
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
test/Microsoft.ComponentDetection.Orchestrator.Tests/Commands/ScanSettingsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
namespace Microsoft.ComponentDetection.Orchestrator.Tests.Commands; | ||
|
||
using System.IO; | ||
using FluentAssertions; | ||
using Microsoft.ComponentDetection.Orchestrator.Commands; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
[TestClass] | ||
[TestCategory("Governance/All")] | ||
[TestCategory("Governance/ComponentDetection")] | ||
public class ScanSettingsTests | ||
{ | ||
[TestMethod] | ||
public void Validate_ChecksNullSourceDirectory() | ||
{ | ||
var settings = new ScanSettings(); | ||
|
||
var result = settings.Validate(); | ||
|
||
result.Successful.Should().BeFalse(); | ||
} | ||
|
||
[TestMethod] | ||
public void Validate_ChecksSourceDirectoryExists() | ||
{ | ||
var settings = new ScanSettings | ||
{ | ||
SourceDirectory = new DirectoryInfo(Path.GetTempPath()), | ||
}; | ||
|
||
var result = settings.Validate(); | ||
|
||
result.Successful.Should().BeTrue(); | ||
} | ||
|
||
[TestMethod] | ||
public void Validate_FailIfSourceDirectoryDoesntExist() | ||
{ | ||
var settings = new ScanSettings | ||
{ | ||
SourceDirectory = new DirectoryInfo(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName())), | ||
}; | ||
|
||
var result = settings.Validate(); | ||
|
||
result.Successful.Should().BeFalse(); | ||
} | ||
} |