public void GetAllFilesInfo()
        {
            // ReSharper disable once InconsistentNaming
            const string FolderExample = "FolderExample";

            EngineState s = EngineTests.CreateEngineState();
            string      pbOriginScript = Path.Combine("%TestBench%", "EncodedFile", "ExtractFileTests.script");
            string      originScript   = StringEscaper.Preprocess(s, pbOriginScript);

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

            // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
            void Template(bool inspectEncodedSize, Dictionary <string, List <EncodedFileInfo> > compDict)
            {
                EncodedFile.GetFileInfoOptions opts = new EncodedFile.GetFileInfoOptions
                {
                    InspectEncodeMode = inspectEncodedSize,
                };
                ResultReport <Dictionary <string, List <EncodedFileInfo> > > report = EncodedFile.GetAllFilesInfo(sc, opts);

                Assert.IsTrue(report.Success);
                Dictionary <string, List <EncodedFileInfo> > infoDict = report.Result;

                Assert.AreEqual(compDict.Count, infoDict.Count);
                foreach (var kv in compDict)
                {
                    Assert.IsTrue(infoDict.ContainsKey(kv.Key));
                    Assert.AreEqual(kv.Value.Count, infoDict[kv.Key].Count);
                    foreach (EncodedFileInfo fileInfo in kv.Value)
                    {
                        Assert.IsTrue(infoDict[kv.Key].Contains(fileInfo));
                    }
                }
            }

            Dictionary <string, List <EncodedFileInfo> > compDetailDict = new Dictionary <string, List <EncodedFileInfo> >
            {
                ["FolderExample"] = new List <EncodedFileInfo>
                {
                    new EncodedFileInfo
                    {
                        FolderName  = FolderExample,
                        FileName    = "Type1.jpg",
                        RawSize     = 7683,
                        EncodedSize = 10244,
                        EncodeMode  = EncodedFile.EncodeMode.ZLib
                    },
                    new EncodedFileInfo
                    {
                        FolderName  = FolderExample,
                        FileName    = "Type2.7z",
                        RawSize     = 1631,
                        EncodedSize = 2175,
                        EncodeMode  = EncodedFile.EncodeMode.Raw
                    },
                    new EncodedFileInfo
                    {
                        FolderName  = FolderExample,
                        FileName    = "Type3.pdf",
                        RawSize     = 88692,
                        EncodedSize = 102908,
                        EncodeMode  = EncodedFile.EncodeMode.XZ
                    }
                },
                ["FolderRun"] = new List <EncodedFileInfo>
                {
                    new EncodedFileInfo
                    {
                        FolderName  = "FolderRun",
                        FileName    = "TestBatch.cmd",
                        RawSize     = 34,
                        EncodedSize = 144,
                        EncodeMode  = EncodedFile.EncodeMode.Raw
                    }
                },
                ["BannerImage"] = new List <EncodedFileInfo>
                {
                    new EncodedFileInfo
                    {
                        FolderName  = "BannerImage",
                        FileName    = "Banner.bmp",
                        RawSize     = 17626,
                        EncodedSize = 23502,
                        EncodeMode  = EncodedFile.EncodeMode.ZLib
                    },
                    new EncodedFileInfo
                    {
                        FolderName  = "BannerImage",
                        FileName    = "Banner.svg",
                        RawSize     = 4715,
                        EncodedSize = 6287,
                        EncodeMode  = EncodedFile.EncodeMode.ZLib
                    },
                }
            };

            Dictionary <string, List <EncodedFileInfo> > compNoDetailDict = new Dictionary <string, List <EncodedFileInfo> >();

            foreach (var kv in compDetailDict)
            {
                compNoDetailDict[kv.Key] = new List <EncodedFileInfo>();
                foreach (EncodedFileInfo info in kv.Value)
                {
                    EncodedFileInfo clone = info.Clone() as EncodedFileInfo;
                    Assert.IsTrue(clone != null);

                    clone.EncodeMode = null;

                    compNoDetailDict[kv.Key].Add(clone);
                }
            }

            Template(true, compDetailDict);
            Template(false, compNoDetailDict);
        }
        public void GetFolderInfo()
        {
            // ReSharper disable once InconsistentNaming
            const string FolderExample = "FolderExample";

            EngineState s = EngineTests.CreateEngineState();
            string      pbOriginScript = Path.Combine("%TestBench%", "EncodedFile", "ExtractFileTests.script");
            string      originScript   = StringEscaper.Preprocess(s, pbOriginScript);

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

            // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
            void Template(bool detail, List <EncodedFileInfo> comps)
            {
                ResultReport <EncodedFileInfo[]> report = EncodedFile.GetFolderInfo(sc, FolderExample, detail);

                Assert.IsTrue(report.Success);
                EncodedFileInfo[] infos = report.Result;
                Assert.AreEqual(comps.Count, infos.Length);
                for (int i = 0; i < comps.Count; i++)
                {
                    Assert.IsTrue(comps[i].Equals(infos[i]));
                }
            }

            List <EncodedFileInfo> compDetailList = new List <EncodedFileInfo>
            {
                new EncodedFileInfo
                {
                    FolderName  = FolderExample,
                    FileName    = "Type1.jpg",
                    RawSize     = 7683,
                    EncodedSize = 10244,
                    EncodeMode  = EncodedFile.EncodeMode.ZLib
                },
                new EncodedFileInfo
                {
                    FolderName  = FolderExample,
                    FileName    = "Type2.7z",
                    RawSize     = 1631,
                    EncodedSize = 2175,
                    EncodeMode  = EncodedFile.EncodeMode.Raw
                },
                new EncodedFileInfo
                {
                    FolderName  = FolderExample,
                    FileName    = "Type3.pdf",
                    RawSize     = 88692,
                    EncodedSize = 102908,
                    EncodeMode  = EncodedFile.EncodeMode.XZ
                }
            };

            List <EncodedFileInfo> compNoDetailList = new List <EncodedFileInfo>();

            foreach (EncodedFileInfo info in compDetailList)
            {
                EncodedFileInfo clone = info.Clone() as EncodedFileInfo;
                Assert.IsTrue(clone != null);
                clone.EncodeMode = null;
                compNoDetailList.Add(clone);
            }

            Template(true, compDetailList);
            Template(false, compNoDetailList);
        }