Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -6,6 +6,7 @@
using System.Threading.Tasks;
using Cake.Common.Build.GitHubActions.Commands;
using Cake.Common.Build.GitHubActions.Data;
using Cake.Common.Tests.Fakes;
using Cake.Core;
using Cake.Core.IO;
using Cake.Testing;
Expand Down Expand Up @@ -108,18 +109,20 @@ internal sealed class GitHubActionsCommandsFixture : HttpMessageHandler
private GitHubActionsInfoFixture GitHubActionsInfoFixture { get; }
private ICakeEnvironment Environment { get; }
public FakeFileSystem FileSystem { get; }
public FakeBuildSystemServiceMessageWriter Writer { get; }

public GitHubActionsCommandsFixture()
{
GitHubActionsInfoFixture = new GitHubActionsInfoFixture();
FileSystem = new FakeFileSystem(GitHubActionsInfoFixture.Environment);
FileSystem.CreateDirectory("/opt");
Environment = GitHubActionsInfoFixture.Environment;
Writer = new FakeBuildSystemServiceMessageWriter();
}

public GitHubActionsCommands CreateGitHubActionsCommands()
{
return new GitHubActionsCommands(Environment, FileSystem, GitHubActionsInfoFixture.CreateEnvironmentInfo(), CreateClient);
return new GitHubActionsCommands(Environment, FileSystem, Writer, GitHubActionsInfoFixture.CreateEnvironmentInfo(), CreateClient);
}

public GitHubActionsCommandsFixture WithWorkingDirectory(DirectoryPath workingDirectory)
Expand Down
5 changes: 4 additions & 1 deletion src/Cake.Common.Tests/Fixtures/Build/GitHubActionsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using Cake.Common.Build.GitHubActions;
using Cake.Common.Tests.Fakes;
using Cake.Core;
using Cake.Core.IO;
using Cake.Testing;
Expand All @@ -14,13 +15,15 @@ internal sealed class GitHubActionsFixture
{
public ICakeEnvironment Environment { get; }
public IFileSystem FileSystem { get; }
public FakeBuildSystemServiceMessageWriter Writer { get; }

public GitHubActionsFixture()
{
Environment = Substitute.For<ICakeEnvironment>();
Environment.GetEnvironmentVariable("GITHUB_ACTIONS").Returns((string)null);
Environment.WorkingDirectory.Returns("/home/cake");
FileSystem = new FakeFileSystem(Environment);
Writer = new FakeBuildSystemServiceMessageWriter();
}

public void IsRunningOnGitHubActions()
Expand All @@ -30,7 +33,7 @@ public void IsRunningOnGitHubActions()

public GitHubActionsProvider CreateGitHubActionsService()
{
return new GitHubActionsProvider(Environment, FileSystem);
return new GitHubActionsProvider(Environment, FileSystem, Writer);
}
}
}
Loading