public GenerateData()
            {
                _expectedId      = Guid.NewGuid().ToString();
                _expectedName    = "Test User Name";
                _expectedEmail   = "*****@*****.**";
                _expectedMessage = "Add a new widget\n* some code\n* some tests";
                _expectedBranch  = "feature";

                IEnvironmentVariables variables = new TestEnvironmentVariables(new Dictionary <string, string>
                {
                    { "APPVEYOR", "True" },
                    { "APPVEYOR_REPO_COMMIT", _expectedId },
                    { "APPVEYOR_REPO_COMMIT_AUTHOR", _expectedName },
                    { "APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL", _expectedEmail },
                    { "APPVEYOR_REPO_COMMIT_MESSAGE", _expectedMessage },
                    { "APPVEYOR_REPO_BRANCH", _expectedBranch }
                });

                var sut = new AppVeyorGitDataResolver(variables);

                var generatedData = sut.GenerateData();
                var data          = generatedData.HasValue
                    ? generatedData.Value.Match(g => g, c => (GitData?)null)
                    : null;

                _gitData = data ?? throw new Exception("Expected GitData");
            }
Exemplo n.º 2
0
        public void GenerateDataNoEnviromentDataReturnsEmptyGitData()
        {
            IEnvironmentVariables variables = new TestEnvironmentVariables(new Dictionary <string, string>
            {
                { "APPVEYOR", "True" }
            });

            var sut = new AppVeyorGitDataResolver(variables);

            var gitData = sut.GenerateData();

            Assert.NotNull(gitData);
        }
        public void GenerateDataNoEnviromentDataReturnsEmptyGitData()
        {
            IEnvironmentVariables variables = new TestEnvironmentVariables(new Dictionary<string, string>
            {
                {"APPVEYOR", "True"}
            });

            var sut = new AppVeyorGitDataResolver(variables);

            var gitData = sut.GenerateData();

            Assert.NotNull(gitData);
        }
            public GenerateData()
            {
                _expectedId = Guid.NewGuid().ToString();
                _expectedName = "Test User Name";
                _expectedEmail = "*****@*****.**";
                _expectedMessage = "Add a new widget\n* some code\n* some tests";
                _expectedBranch = "feature";

                IEnvironmentVariables variables = new TestEnvironmentVariables(new Dictionary<string, string>
                {
                    {"APPVEYOR", "True"},
                    {"APPVEYOR_REPO_COMMIT", _expectedId},
                    {"APPVEYOR_REPO_COMMIT_AUTHOR", _expectedName},
                    {"APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL", _expectedEmail},
                    {"APPVEYOR_REPO_COMMIT_MESSAGE", _expectedMessage},
                    {"APPVEYOR_REPO_BRANCH", _expectedBranch}
                });

                var sut = new AppVeyorGitDataResolver(variables);

                _gitData = sut.GenerateData();
            }