示例#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);
        }
示例#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]);
        }
示例#3
0
        public void Constructor_with_Dependencies_returns_Instance()
        {
            var instance = new DockerSecretParser(new FileSystem());

            Assert.NotNull(instance);
        }