-
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 #233 from corgibytes/feature/git_clone_repository
Dispatches compute history activity from git repository cloned event
- Loading branch information
Showing
7 changed files
with
110 additions
and
39 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
40 changes: 40 additions & 0 deletions
40
Corgibytes.Freshli.Cli.Test/Functionality/Git/GitRepositoryClonedEventTest.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,40 @@ | ||
using System; | ||
using Corgibytes.Freshli.Cli.Functionality.Analysis; | ||
using Corgibytes.Freshli.Cli.Functionality.Engine; | ||
using Corgibytes.Freshli.Cli.Functionality.Git; | ||
using Corgibytes.Freshli.Cli.Functionality.History; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace Corgibytes.Freshli.Cli.Test.Functionality.Git; | ||
|
||
[UnitTest] | ||
public class GitRepositoryClonedEventTest | ||
{ | ||
[Fact] | ||
public void CorrectlyDispatchesComputeHistoryActivity() | ||
{ | ||
var gitPath = "test"; | ||
var cacheDir = "example"; | ||
var gitRepositoryId = "example"; | ||
var analysisId = new Guid(); | ||
var analysisLocation = new AnalysisLocation(cacheDir, gitRepositoryId); | ||
|
||
var clonedEvent = new GitRepositoryClonedEvent | ||
{ | ||
AnalysisId = analysisId, | ||
GitPath = gitPath, | ||
AnalysisLocation = analysisLocation | ||
}; | ||
|
||
var engine = new Mock<IApplicationActivityEngine>(); | ||
|
||
clonedEvent.Handle(engine.Object); | ||
|
||
// Verify that it dispatches ComputeHistoryActivity | ||
engine.Verify(mock => mock.Dispatch(It.Is<ComputeHistoryActivity>(value => | ||
value.AnalysisId == analysisId && | ||
value.GitExecutablePath == gitPath && | ||
value.AnalysisLocation == analysisLocation))); | ||
} | ||
} |
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
Empty file.
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
15 changes: 8 additions & 7 deletions
15
Corgibytes.Freshli.Cli/Functionality/Git/GitRepositoryClonedEvent.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 |
---|---|---|
@@ -1,17 +1,18 @@ | ||
using System; | ||
using Corgibytes.Freshli.Cli.Functionality.Analysis; | ||
using Corgibytes.Freshli.Cli.Functionality.Engine; | ||
using Corgibytes.Freshli.Cli.Functionality.History; | ||
|
||
namespace Corgibytes.Freshli.Cli.Functionality.Git; | ||
|
||
public class GitRepositoryClonedEvent : IApplicationEvent | ||
{ | ||
public string GitRepositoryId { get; init; } = null!; | ||
|
||
// ReSharper disable once UnusedAutoPropertyAccessor.Global | ||
public Guid AnalysisId { get; init; } | ||
|
||
public void Handle(IApplicationActivityEngine eventClient) | ||
{ | ||
// TODO - Dispatch(ComputeHistoryActivity) | ||
} | ||
public string GitPath { get; init; } = null!; | ||
|
||
public AnalysisLocation AnalysisLocation { get; init; } = null!; | ||
|
||
public void Handle(IApplicationActivityEngine eventClient) => | ||
eventClient.Dispatch(new ComputeHistoryActivity(GitPath, AnalysisId, AnalysisLocation)); | ||
} |
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