public void ProcArgs_TryGetSetting()
        {
            // 0. Setup
            ListPropertiesProvider cmdLineProps = new ListPropertiesProvider();
            cmdLineProps.AddProperty("cmd.key.1", "cmd value 1");
            cmdLineProps.AddProperty("shared.key.1", "shared cmd value");

            ListPropertiesProvider fileProps = new ListPropertiesProvider();
            fileProps.AddProperty("file.key.1", "file value 1");
            fileProps.AddProperty("shared.key.1", "shared file value");

            ProcessedArgs args = new ProcessedArgs("key", "name", "ver", false, cmdLineProps, fileProps);

            // 1. Missing key -> null
            string result;
            Assert.IsFalse(args.TryGetSetting("missing.property", out result), "Expecting false when the specified key does not exist");
            Assert.IsNull(result, "Expecting the value to be null when the specified key does not exist");

            // 2. Returns existing values
            Assert.IsTrue(args.TryGetSetting("cmd.key.1", out result));
            Assert.AreEqual("cmd value 1", result);

            // 3. Precedence - command line properties should win
            Assert.AreEqual("shared cmd value", args.GetSetting("shared.key.1"));

            // 4. Preprocessor only settings
            Assert.AreEqual(false, args.InstallLoaderTargets);
        }
        public void ProcArgs_TryGetSetting()
        {
            // 0. Setup
            ListPropertiesProvider cmdLineProps = new ListPropertiesProvider();

            cmdLineProps.AddProperty("cmd.key.1", "cmd value 1");
            cmdLineProps.AddProperty("shared.key.1", "shared cmd value");

            ListPropertiesProvider fileProps = new ListPropertiesProvider();

            fileProps.AddProperty("file.key.1", "file value 1");
            fileProps.AddProperty("shared.key.1", "shared file value");

            ProcessedArgs args = new ProcessedArgs("key", "name", "ver", false, cmdLineProps, fileProps);

            // 1. Missing key -> null
            string result;

            Assert.IsFalse(args.TryGetSetting("missing.property", out result), "Expecting false when the specified key does not exist");
            Assert.IsNull(result, "Expecting the value to be null when the specified key does not exist");

            // 2. Returns existing values
            Assert.IsTrue(args.TryGetSetting("cmd.key.1", out result));
            Assert.AreEqual("cmd value 1", result);

            // 3. Precedence - command line properties should win
            Assert.AreEqual("shared cmd value", args.GetSetting("shared.key.1"));

            // 4. Preprocessor only settings
            Assert.AreEqual(false, args.InstallLoaderTargets);
        }
예제 #3
0
        private static void AssertExpectedValue(string key, string expectedValue, ProcessedArgs args)
        {
            var found = args.TryGetSetting(key, out string actualValue);

            found.Should().BeTrue("Expected setting was not found. Key: {0}", key);
            actualValue.Should().Be(expectedValue, "Setting does not have the expected value. Key: {0}", key);
        }
예제 #4
0
        public void ProcArgs_TryGetSetting()
        {
            // 1. Missing key -> null
            args.TryGetSetting("missing.property", out string result).Should().BeFalse("Expecting false when the specified key does not exist");
            result.Should().BeNull("Expecting the value to be null when the specified key does not exist");

            // 2. Returns existing values
            args.TryGetSetting("cmd.key.1", out result).Should().BeTrue();
            result.Should().Be("cmd value 1");

            // 3. Precedence - command line properties should win
            args.GetSetting("shared.key.1").Should().Be("shared cmd value");

            // 4. Preprocessor only settings
            args.InstallLoaderTargets.Should().BeTrue();
        }
예제 #5
0
        public void ProcArgs_TryGetSetting()
        {
            // 1. Missing key -> null
            Assert.IsFalse(args.TryGetSetting("missing.property", out string result), "Expecting false when the specified key does not exist");
            Assert.IsNull(result, "Expecting the value to be null when the specified key does not exist");

            // 2. Returns existing values
            Assert.IsTrue(args.TryGetSetting("cmd.key.1", out result));
            Assert.AreEqual("cmd value 1", result);

            // 3. Precedence - command line properties should win
            Assert.AreEqual("shared cmd value", args.GetSetting("shared.key.1"));

            // 4. Preprocessor only settings
            Assert.AreEqual(true, args.InstallLoaderTargets);
        }
예제 #6
0
        private static void AssertExpectedValue(string key, string expectedValue, ProcessedArgs args)
        {
            var found = args.TryGetSetting(key, out string actualValue);

            Assert.IsTrue(found, "Expected setting was not found. Key: {0}", key);
            Assert.AreEqual(expectedValue, actualValue, "Setting does not have the expected value. Key: {0}", key);
        }
        private static void AssertExpectedValue(string key, string expectedValue, ProcessedArgs args)
        {
            string actualValue;
            bool found = args.TryGetSetting(key, out actualValue);

            Assert.IsTrue(found, "Expected setting was not found. Key: {0}", key);
            Assert.AreEqual(expectedValue, actualValue, "Setting does not have the expected value. Key: {0}", key);
        }