-
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 #245 from corgibytes/bom-dispatches-compute-libyear
BillOfMaterialsGeneratedEvent dispatch ComputeLibYearActivity
- Loading branch information
Showing
4 changed files
with
54 additions
and
11 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
Corgibytes.Freshli.Cli.Test/Functionality/Git/BillOfMaterialsGeneratedEventTest.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,38 @@ | ||
using System; | ||
using Corgibytes.Freshli.Cli.Functionality; | ||
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.Git; | ||
|
||
public class BillOfMaterialsGeneratedEventTest | ||
{ | ||
[Fact] | ||
public void CorrectlyDispatchesComputeLibYearActivity() | ||
{ | ||
var serviceProvider = new Mock<IServiceProvider>(); | ||
var calculateLibYearFromFile = new Mock<ICalculateLibYearFromFile>(); | ||
var analysisLocation = new AnalysisLocation("/cache/directory", "2dbc2fd2358e1ea1b7a6bc08ea647b9a337ac92d", | ||
"da39a3ee5e6b4b0d3255bfef95601890afd80709"); | ||
var pathToBoM = "/path/to/bom"; | ||
|
||
var billOfMaterialsGeneratedEvent = new BillOfMaterialsGeneratedEvent(analysisLocation, pathToBoM); | ||
|
||
serviceProvider.Setup(mock => mock.GetService(typeof(ICalculateLibYearFromFile))) | ||
.Returns(calculateLibYearFromFile.Object); | ||
|
||
var engine = new Mock<IApplicationActivityEngine>(); | ||
engine.Setup(mock => mock.ServiceProvider).Returns(serviceProvider.Object); | ||
|
||
billOfMaterialsGeneratedEvent.Handle(engine.Object); | ||
|
||
engine.Verify(mock => mock.Dispatch(It.Is<ComputeLibYearActivity>(value => | ||
value.AnalysisLocation == analysisLocation && | ||
value.PathToBoM == pathToBoM | ||
))); | ||
} | ||
} |
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