Example #1
0
        public void Branch_EnvVariableSet_IsCorrectValue()
        {
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_BRANCH", "master");
            var git = new AppVeyorGit();

            git.CurrentBranch.Should().Be("master");
        }
        public void Head_PullRequestNumberSet_HasCorrectValue()
        {
            Environment.SetEnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER", "1234abcd");

            var git = new AppVeyorGit();

            git.Head.PullRequestId.Should().Be("1234abcd");
        }
        public void Branches_EnvVariableSet_IsTheOnlyValue()
        {
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_BRANCH", "master");

            var git = new AppVeyorGit();

            git.Branches.Single().Should().Be("master");
        }
Example #4
0
        public void Head_EnvVariablesNotSet_HasNullValues()
        {
            var git = new AppVeyorGit();

            git.Head.Id.Should().Be(null);
            git.Head.Message.Should().Be(null);
            git.Head.Author.Should().Be(null);
            git.Head.AuthorEmail.Should().Be(null);
        }
        public void Commits_EnvVariablesSet_OnlyContainsHead()
        {
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_COMMIT", "1234abcd");
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_COMMIT_MESSAGE", "Initial commit");
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_COMMIT_AUTHOR", "jdeering");
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_COMMIT_AUTHOREMAIL", "*****@*****.**");

            var git = new AppVeyorGit();

            git.Commits.Single().Should().Be(git.Head);
        }
Example #6
0
        public void Head_EnvVariablesSet_HasCorrectValues()
        {
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_COMMIT", "1234abcd");
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_COMMIT_MESSAGE", "Initial commit");
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_COMMIT_AUTHOR", "jdeering");
            Environment.SetEnvironmentVariable("APPVEYOR_REPO_COMMIT_AUTHOREMAIL", "*****@*****.**");

            var git = new AppVeyorGit();

            git.Head.Id.Should().Be("1234abcd");
            git.Head.Message.Should().Be("Initial commit");
            git.Head.Author.Should().Be("jdeering");
            git.Head.AuthorEmail.Should().Be("*****@*****.**");
        }
Example #7
0
        public void CoverallsData_PullRequestId_PullsFromGitData()
        {
            Environment.SetEnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER", "b31f08d07ae564b08237e5a336e478b24ccc4a65");
            var git = new AppVeyorGit();

            var coverallsData = new CoverallsData
            {
                ServiceName  = "ServiceName",
                ServiceJobId = "JobId",
                RepoToken    = "b31f08d07ae564b08237e5a336e478b24ccc4a65",
                SourceFiles  = (new List <CoverageFile>()).ToArray(),
                Git          = git.Data
            };

            coverallsData.ServicePullRequest.Should().Be("b31f08d07ae564b08237e5a336e478b24ccc4a65");
        }
Example #8
0
        public void CoverallsData_NullPullRequestId_IsNotInJSON()
        {
            var git = new AppVeyorGit();

            var coverallsData = new CoverallsData
            {
                ServiceName  = "ServiceName",
                ServiceJobId = "JobId",
                RepoToken    = "b31f08d07ae564b08237e5a336e478b24ccc4a65",
                SourceFiles  = (new List <CoverageFile>()).ToArray(),
                Git          = git.Data
            };

            var json = JsonConvert.SerializeObject(coverallsData);

            json.Should().NotContain("service_pull_request");
        }
Example #9
0
        public void CoverallsData_FilledPullRequestId_IsInJSON()
        {
            Environment.SetEnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER", "b31f08d07ae564b08237e5a336e478b24ccc4a65");
            var git = new AppVeyorGit();

            var coverallsData = new CoverallsData
            {
                ServiceName  = "ServiceName",
                ServiceJobId = "JobId",
                RepoToken    = "b31f08d07ae564b08237e5a336e478b24ccc4a65",
                SourceFiles  = (new List <CoverageFile>()).ToArray(),
                Git          = git.Data
            };

            var json = JsonConvert.SerializeObject(coverallsData);

            json.Should().Contain("service_pull_request");
        }
Example #10
0
        public void Branch_EnvVariableNotSet_IsNull()
        {
            var git = new AppVeyorGit();

            git.CurrentBranch.Should().Be(null);
        }