예제 #1
0
        public void GetEnviornmentVariables_Should_Never_Be_Null()
        {
            // Given
            var options = Substitute.For <IEnviornmentVariablesOptions>();
            var enviornmentVariables = new Codecov.Coverage.EnviornmentVariables.EnviornmentVariables(options);

            // When
            var getEnviornmentVariables = enviornmentVariables.UserEnvironmentVariables;

            // Then
            getEnviornmentVariables.Should().NotBeNull();
        }
        public void GetEnviornmentVariables_Should_Never_Be_Null()
        {
            // Given
            var options = Substitute.For <IEnviornmentVariablesOptions>();
            var continuousIntegrationServer = Substitute.For <IContinuousIntegrationServer>();
            var enviornmentVariables        = new Codecov.Coverage.EnviornmentVariables.EnviornmentVariables(options, continuousIntegrationServer);

            // When
            var getEnviornmentVariables = enviornmentVariables.GetEnviornmentVariables;

            // Then
            getEnviornmentVariables.Should().NotBeNull();
        }
        public void Should_Include_CODECOV_ENV()
        {
            // Given
            var options = Substitute.For <IEnviornmentVariablesOptions>();
            var continuousIntegrationServer = Substitute.For <IContinuousIntegrationServer>();
            var enviornmentVariables        = new Codecov.Coverage.EnviornmentVariables.EnviornmentVariables(options, continuousIntegrationServer);

            Environment.SetEnvironmentVariable("CODECOV_ENV", "foo");

            // When
            var getEnviornmentVariables = enviornmentVariables.GetEnviornmentVariables;

            // Then
            getEnviornmentVariables["CODECOV_ENV"].Should().Be("foo");
        }
예제 #4
0
        public void Should_Include_CODECOV_ENV()
        {
            // Given
            Environment.SetEnvironmentVariable("CODECOV_ENV", "foo");
            var options = Substitute.For <IEnviornmentVariablesOptions>();
            var continuousIntegrationServer = Substitute.For <IContinuousIntegrationServer>();
            var enviornmentVariables        = new Codecov.Coverage.EnviornmentVariables.EnviornmentVariables(options);

            enviornmentVariables.LoadEnviornmentVariables(continuousIntegrationServer);

            // When
            var getEnviornmentVariables = enviornmentVariables.UserEnvironmentVariables;

            // Then
            getEnviornmentVariables.Should().ContainKey("CODECOV_ENV").WhichValue.Should().Be("foo");
        }
        public void Should_Include_EnviornmentVariables_From_Options()
        {
            // Given
            var options = Substitute.For <IEnviornmentVariablesOptions>();

            options.Envs.Returns(new[] { "foo", "fizz" });
            var continuousIntegrationServer = Substitute.For <IContinuousIntegrationServer>();
            var enviornmentVariables        = new Codecov.Coverage.EnviornmentVariables.EnviornmentVariables(options, continuousIntegrationServer);

            Environment.SetEnvironmentVariable("foo", "bar");
            Environment.SetEnvironmentVariable("fizz", "bizz");

            // When
            var getEnviornmentVariables = enviornmentVariables.GetEnviornmentVariables;

            // Then
            getEnviornmentVariables["foo"].Should().Be("bar");
            getEnviornmentVariables["fizz"].Should().Be("bizz");
        }
예제 #6
0
        public void Should_Include_EnviornmentVariables_From_ContiniousIntegrationServer()
        {
            // Given
            Environment.SetEnvironmentVariable("foo", null);
            Environment.SetEnvironmentVariable("fizz", null);
            var options = Substitute.For <IEnviornmentVariablesOptions>();
            var continuousIntegrationServer = Substitute.For <IContinuousIntegrationServer>();

            continuousIntegrationServer.UserEnvironmentVariables.Returns(new Dictionary <string, string> {
                { "foo", "bar" }, { "fizz", "bizz" }
            });
            var enviornmentVariables = new Codecov.Coverage.EnviornmentVariables.EnviornmentVariables(options);

            enviornmentVariables.LoadEnviornmentVariables(continuousIntegrationServer);

            // When
            var getEnviornmentVariables = enviornmentVariables.UserEnvironmentVariables;

            // Then
            getEnviornmentVariables.Should().ContainKey("foo").WhichValue.Should().Be("bar");
            getEnviornmentVariables.Should().ContainKey("fizz").WhichValue.Should().Be("bizz");
        }