コード例 #1
0
        public void PreArgProc_DynamicSettings()
        {
            // 0. Setup - none

            // 1. Args ok
            ProcessedArgs result = CheckProcessingSucceeds(
                // Non-dynamic values
                "/key:my.key", "/name:my name", "/version:1.2",
                // Dynamic values
                "/d:sonar.host.url=required value",
                "/d:key1=value1",
                "/d:key2=value two with spaces"
                );

            AssertExpectedValues("my.key", "my name", "1.2", result);

            AssertExpectedPropertyValue(SonarProperties.HostUrl, "required value", result);
            AssertExpectedPropertyValue("key1", "value1", result);
            AssertExpectedPropertyValue("key2", "value two with spaces", result);

            Assert.IsNotNull(result.GetAllProperties(), "GetAllProperties should not return null");
            Assert.AreEqual(3, result.GetAllProperties().Count(), "Unexpected number of properties");
        }
コード例 #2
0
        private static void AssertExpectedPropertyValue(string key, string value, ProcessedArgs actual)
        {
            // Test the GetSetting method
            var actualValue = actual.GetSetting(key);

            actualValue.Should().NotBeNull("Expected dynamic settings does not exist. Key: {0}", key);
            actualValue.Should().Be(value, "Dynamic setting does not have the expected value");

            // Check the public list of properties
            var found = Property.TryGetProperty(key, actual.GetAllProperties(), out Property match);

            found.Should().BeTrue("Failed to find the expected property. Key: {0}", key);
            match.Should().NotBeNull("Returned property should not be null. Key: {0}", key);
            match.Value.Should().Be(value, "Property does not have the expected value");
        }
コード例 #3
0
        private static void AssertExpectedPropertyValue(string key, string value, ProcessedArgs actual)
        {
            // Test the GetSetting method
            string actualValue = actual.GetSetting(key);

            Assert.IsNotNull(actualValue, "Expected dynamic settings does not exist. Key: {0}", key);
            Assert.AreEqual(value, actualValue, "Dynamic setting does not have the expected value");

            // Check the public list of properties
            bool found = Property.TryGetProperty(key, actual.GetAllProperties(), out Property match);

            Assert.IsTrue(found, "Failed to find the expected property. Key: {0}", key);
            Assert.IsNotNull(match, "Returned property should not be null. Key: {0}", key);
            Assert.AreEqual(value, match.Value, "Property does not have the expected value");
        }
コード例 #4
0
        private static void AssertExpectedPropertyValue(string key, string value, ProcessedArgs actual)
        {
            // Test the GetSetting method
            string actualValue = actual.GetSetting(key);
            Assert.IsNotNull(actualValue, "Expected dynamic settings does not exist. Key: {0}", key);
            Assert.AreEqual(value, actualValue, "Dynamic setting does not have the expected value");

            // Check the public list of properties
            Property match;
            bool found = Property.TryGetProperty(key, actual.GetAllProperties(), out match);
            Assert.IsTrue(found, "Failed to find the expected property. Key: {0}", key);
            Assert.IsNotNull(match, "Returned property should not be null. Key: {0}", key);
            Assert.AreEqual(value, match.Value, "Property does not have the expected value");
        }