Beispiel #1
0
        public void Parse_where_NoSecretsExist_returns_EmptyDictionary()
        {
            // where .Exists always returns false
            var emptyFileSystem = new MockFileSystem();

            var parser = new DockerSecretParser(emptyFileSystem);

            var result = parser.Parse();

            Assert.Empty(result);
        }
Beispiel #2
0
        public void Parse_where_DockerSecretsExist_returns_DotnetConfigValues()
        {
            var shallowKey   = "ShallowKey";
            var shallowValue = "---shallow-value---";

            var nestedDockerKey = "Nested_Key";
            var nestedDotnetKey = "Nested:Key";
            var nestedValue     = "---nested-value---";

            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { string.Concat(DOCKER_SECRET_PATH, shallowKey), new MockFileData(shallowValue) },
                { string.Concat(DOCKER_SECRET_PATH, nestedDockerKey), new MockFileData(nestedValue) }
            });

            var parser = new DockerSecretParser(fileSystem);

            var result = parser.Parse();

            Assert.Equal(shallowValue, result[shallowKey]);
            Assert.Equal(nestedValue, result[nestedDotnetKey]);
        }