-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #246 from corgibytes/manifest-detected-dispatches-…
…generate-bom ManifestDetectedEvent dispatches GenerateBillOfMaterialsActivity
- Loading branch information
Showing
4 changed files
with
53 additions
and
21 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
Corgibytes.Freshli.Cli.Test/Functionality/Analysis/ManifestDetectedEventTest.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,37 @@ | ||
using System; | ||
using Corgibytes.Freshli.Cli.Functionality.Analysis; | ||
using Corgibytes.Freshli.Cli.Functionality.BillOfMaterials; | ||
using Corgibytes.Freshli.Cli.Functionality.Engine; | ||
using Corgibytes.Freshli.Cli.Services; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace Corgibytes.Freshli.Cli.Test.Functionality.Analysis; | ||
|
||
[UnitTest] | ||
public class ManifestDetectedEventTest | ||
{ | ||
[Fact] | ||
public void CorrectlyDispatchesGenerateBillOfMaterialsActivity() | ||
{ | ||
var manifestPath = "/path/to/manifest"; | ||
var billOfMaterialsPath = "/path/to/bom"; | ||
var analysisLocation = new AnalysisLocation("/cache/directory", "2dbc2fd2358e1ea1b7a6bc08ea647b9a337ac92d", | ||
"da39a3ee5e6b4b0d3255bfef95601890afd80709"); | ||
|
||
var javaAgentReader = new Mock<IAgentReader>(); | ||
|
||
javaAgentReader.Setup(mock => mock.ProcessManifest(manifestPath, It.IsAny<DateTime>())).Returns(billOfMaterialsPath); | ||
|
||
var engine = new Mock<IApplicationActivityEngine>(); | ||
|
||
var manifestEvent = new ManifestDetectedEvent(analysisLocation, javaAgentReader.Object, manifestPath); | ||
manifestEvent.Handle(engine.Object); | ||
|
||
engine.Verify(mock => mock.Dispatch(It.Is<GenerateBillOfMaterialsActivity>(value => | ||
value.AnalysisLocation == analysisLocation && | ||
value.ManifestPath == manifestPath && | ||
value.AgentReader == javaAgentReader.Object | ||
))); | ||
} | ||
} |
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
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
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