public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateRunnerInfo();

                // When
                var result = info.ImageVersion;

                // Then
                Assert.Equal("20211209.3", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateRuntimeInfo();

                // When
                var result = info.SystemPath.FullPath;

                // Then
                Assert.Equal("/opt/github.path", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateRuntimeInfo();

                // When
                var result = info.Url;

                // Then
                Assert.Equal("https://pipelines.actions.githubusercontent.com/ip0FyYnZXxdEOcOwPHkRsZJd2x6G5XoT486UsAb0/", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateRuntimeInfo();

                // When
                var result = info.Token;

                // Then
                Assert.Equal("zht1j5NeW2T5ZsOxncX4CUEiWYhD4ZRwoDghkARk", result);
            }
            public void Should_Return_Correct_Value(string value, GitHubActionsArchitecture expected)
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateRunnerInfo(architecture: value);

                // When
                var result = info.Architecture;

                // Then
                Assert.Equal(expected, result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.EventPath.FullPath;

                // Then
                Assert.Equal("/home/runner/work/_temp/_github_workflow/event.json", result);
            }
Example #7
0
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateRunnerInfo();

                // When
                var result = info.Workspace.FullPath;

                // Then
                Assert.Equal("/home/runner/work/cake", result);
            }
Example #8
0
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateRunnerInfo();

                // When
                var result = info.OS;

                // Then
                Assert.Equal("Linux", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.BaseRef;

                // Then
                Assert.Equal("master", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.EventName;

                // Then
                Assert.Equal("pull_request", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.Actor;

                // Then
                Assert.Equal("dependabot", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.ApiUrl;

                // Then
                Assert.Equal("https://api.github.com", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.RefProtected;

                // Then
                Assert.True(result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.ActionPath.FullPath;

                // Then
                Assert.Equal("/path/to/action", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.Ref;

                // Then
                Assert.Equal("refs/pull/1/merge", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.RepositoryOwner;

                // Then
                Assert.Equal("cake-build", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateRuntimeInfo();

                // When
                var result = info.IsRuntimeAvailable;

                // Then
                Assert.Equal(true, result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.HeadRef;

                // Then
                Assert.Equal("dependabot/nuget/Microsoft.SourceLink.GitHub-1.0.0", result);
            }
Example #19
0
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateEnvironmentInfo();

                // When
                var result = info.PullRequest;

                // Then
                Assert.NotNull(result);
            }
Example #20
0
            public void Should_Return_Correct_Values()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateEnvironmentInfo();

                // When
                var result = info.Home;

                // Then
                Assert.Equal("/home/runner", result);
            }
            public void Should_Return_Correct_Value(string value, GitHubActionsRefType expected)
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo(refType: value);

                // When
                var result = info.RefType;

                // Then
                Assert.Equal(expected, result);
            }
Example #22
0
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateRunnerInfo();

                // When
                var result = info.ToolCache.FullPath;

                // Then
                Assert.Equal("/opt/hostedtoolcache", result);
            }
            public void Should_Return_Correct_Value()
            {
                // Given
                var info = new GitHubActionsInfoFixture().CreateWorkflowInfo();

                // When
                var result = info.Sha;

                // Then
                Assert.Equal("d1e4f990f57349334368c8253382abc63be02d73", result);
            }
Example #24
0
            public void Should_Throw_If_CreateHttpClient_Is_Null()
            {
                // Given
                var environment        = Substitute.For <ICakeEnvironment>();
                var filesystem         = Substitute.For <IFileSystem>();
                var actionsEnvironment = new GitHubActionsInfoFixture().CreateEnvironmentInfo();

                // When
                var result = Record.Exception(() => new GitHubActionsCommands(environment, filesystem, actionsEnvironment, null));

                // Then
                AssertEx.IsArgumentNullException(result, "createHttpClient");
            }
            public void Should_Return_Correct_Value(string value, bool expected)
            {
                // Given
                var fixture = new GitHubActionsInfoFixture();

                fixture.Environment.GetEnvironmentVariable("GITHUB_EVENT_NAME").Returns(value);
                var info = fixture.CreatePullRequestInfo();

                // When
                var result = info.IsPullRequest;

                // Then
                Assert.Equal(expected, result);
            }