private string ReplaceHelperFileSettings(string theString, string executable)
        {
            var replacementMap = _helperFilesCache.GetReplacementsMap(executable);

            foreach (var nameValuePair in replacementMap)
            {
                theString = theString.Replace($"$({nameValuePair.Key})", nameValuePair.Value);
            }

            return(theString);
        }
示例#2
0
        public void GetReplacementsMap_NoFile_EmptyDictionary()
        {
            string executable    = TestResources.Tests_DebugX86;
            var    extraSettings = HelperFilesCache.GetHelperFile(executable);

            extraSettings.AsFileInfo().Should().NotExist();

            var cache = new HelperFilesCache(MockLogger.Object);
            var map   = cache.GetReplacementsMap(executable);

            map.Should().BeEmpty();
        }
示例#3
0
        private void DoTest(string content, Action <IDictionary <string, string> > assertions, string executable = TestResources.Tests_DebugX86)
        {
            var extraSettings = HelperFilesCache.GetHelperFile(executable);

            try
            {
                extraSettings.AsFileInfo().Should().NotExist();
                File.WriteAllText(extraSettings, content);

                var cache = new HelperFilesCache(MockLogger.Object);
                var map   = cache.GetReplacementsMap(executable);
                assertions(map);
            }
            finally
            {
                File.Delete(extraSettings);
            }
        }