Exemple #1
0
        public void TestDefaultProcessorBuilderFactory_customExecutable()
        {
            ProcessBuilder processBuilder =
                DockerClient.DefaultProcessBuilderFactory("docker-executable", ImmutableDictionary.Create <string, string>())
                    (new[] { "sub", "command" });

            Assert.AreEqual("docker-executable sub command", processBuilder.Command());
            CollectionAssert.AreEquivalent(
                Environment.GetEnvironmentVariables()
                .Cast <DictionaryEntry>()
                .ToDictionary(e => e.Key.ToString(), e => e.Value.ToString()),
                processBuilder.GetEnvironment());
        }
Exemple #2
0
        public void TestDefaultProcessorBuilderFactory_customEnvironment()
        {
            ImmutableDictionary <string, string> environment = ImmutableDic.Of("Key1", "Value1");

            var expectedEnvironment = new Dictionary <string, string>(
                Environment.GetEnvironmentVariables()
                .Cast <DictionaryEntry>()
                .Select(e => new KeyValuePair <string, string>(e.Key?.ToString(), e.Value?.ToString())))
            {
                ["Key1"] = "Value1"
            };

            ProcessBuilder processBuilder =
                DockerClient.DefaultProcessBuilderFactory("docker", environment)(new List <string>());

            CollectionAssert.AreEquivalent(expectedEnvironment, processBuilder.GetEnvironment());
        }