public void CanProvideDataNoEnvironmentVariablesSetReturnsFalse()
        {
            var sut = new TeamCityMetaDataResolver(new TestEnvironmentVariables());

            var canProvideData = sut.IsActive();

            Assert.False(canProvideData);
        }
        public void CanProvideDataTeamCityEnvironmentVariableSetReturnsTrue()
        {
            IEnvironmentVariables variables = new TestEnvironmentVariables(new Dictionary <string, string>
            {
                { "TEAMCITY_VERSION", "10.4.5-monsoon" }
            });

            var sut = new TeamCityMetaDataResolver(variables);

            var canProvideData = sut.IsActive();

            Assert.True(canProvideData);
        }
            public GenerateData()
            {
                _expectedPullRequestId = "42";
                _expectedBuildNumber   = "12";
                _expectedServiceName   = "teamcity";

                IEnvironmentVariables variables = new TestEnvironmentVariables(new Dictionary <string, string>
                {
                    { "TEAMCITY_VERSION", "10.4.5-monsoon" },
                    { "TEAMCITY_BUILD_NUMBER", _expectedBuildNumber },
                    { "TEAMCITY_PULL_REQUEST", _expectedPullRequestId }
                });

                _sut = new TeamCityMetaDataResolver(variables);
            }
        public void TeamcityNoCustomEnvironmentVariableSetReturnsCorrectResults()
        {
            IEnvironmentVariables variables = new TestEnvironmentVariables(new Dictionary <string, string>
            {
                { "TEAMCITY_VERSION", "10.4.5-monsoon" }
            });

            var sut = new TeamCityMetaDataResolver(variables);

            var canProvideData = sut.IsActive();

            Assert.True(canProvideData);
            var serviceNameResult = sut.ResolveServiceName();

            Assert.True(serviceNameResult.HasValue);
            Assert.Equal("teamcity", serviceNameResult.ValueOrDefault());
            Assert.False(sut.ResolvePullRequestId().HasValue);
            Assert.False(sut.ResolveServiceBuildNumber().HasValue);
            Assert.False(sut.ResolveServiceJobId().HasValue);
        }