public void DeleteFolder()
        {
            EngineState s = EngineTests.CreateEngineState();
            string      originScriptPath = Path.Combine(StringEscaper.Preprocess(s, "%TestBench%"), "EncodedFile", "ExtractFileTests.script");

            // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
            void Template(string folderName, bool result)
            {
                string destDir    = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
                string destScript = Path.Combine(destDir, "DeleteFolderTest.script");

                Directory.CreateDirectory(destDir);
                try
                {
                    File.Copy(originScriptPath, destScript, true);

                    Script sc = s.Project.LoadScriptRuntime(destScript, new LoadScriptRuntimeOptions());

                    Dictionary <string, string> fileDict = null;
                    if (result)
                    {
                        fileDict = sc.Sections[folderName].IniDict;
                    }

                    string errMsg;
                    (sc, errMsg) = EncodedFile.DeleteFolder(sc, folderName);

                    if (errMsg != null)
                    {
                        Assert.IsFalse(result);
                        return;
                    }
                    Assert.IsTrue(result);

                    Assert.IsFalse(sc.Sections.ContainsKey(folderName));
                    Assert.IsFalse(IniReadWriter.ContainsSection(destScript, folderName));

                    string[] folders = sc.Sections[EncodedFolders].Lines;
                    Assert.IsFalse(folders.Contains(folderName, StringComparer.OrdinalIgnoreCase));

                    foreach (string fileName in fileDict.Keys)
                    {
                        Assert.IsFalse(sc.Sections.ContainsKey(GetSectionName(folderName, fileName)));
                    }
                }
                finally
                {
                    if (Directory.Exists(destDir))
                    {
                        Directory.Delete(destDir, true);
                    }
                }
            }

            Template("FolderExample", true);
            Template("BannerImage", true);
            Template(AuthorEncoded, true);
            Template(InterfaceEncoded, true);
            Template("ShouldFail", false);
        }