Ejemplo n.º 1
0
        public void GetLogoInfo()
        {
            EngineState s         = EngineTests.CreateEngineState();
            string      scriptDir = Path.Combine(StringEscaper.Preprocess(s, "%TestBench%"), "EncodedFile");

            string logoScriptFile = Path.Combine(scriptDir, "Blank.script");
            Script logoScript     = s.Project.LoadScriptRuntime(logoScriptFile, new LoadScriptRuntimeOptions());

            string noLogoScriptFile = Path.Combine(scriptDir, "CompleteBlank.script");
            Script noLogoScript     = s.Project.LoadScriptRuntime(noLogoScriptFile, new LoadScriptRuntimeOptions());

            // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
            void Template(Script testScript, bool detail, EncodedFileInfo comp)
            {
                ResultReport <EncodedFileInfo> report = EncodedFile.GetLogoInfo(testScript, detail);

                if (comp == null)
                {
                    Assert.IsFalse(report.Success);
                    Assert.IsNull(report.Result);
                }
                else
                {
                    Assert.IsTrue(report.Success);
                    Assert.IsTrue(report.Result.Equals(comp));
                }
            }

            Template(logoScript, true, new EncodedFileInfo
            {
                FolderName  = "AuthorEncoded",
                FileName    = "logo.jpg",
                RawSize     = 973,
                EncodedSize = 1298,
                EncodeMode  = EncodedFile.EncodeMode.ZLib
            });
            Template(logoScript, false, new EncodedFileInfo
            {
                FolderName  = "authorEncoded",
                FileName    = "Logo.jpg",
                RawSize     = 973,
                EncodedSize = 1298,
                EncodeMode  = null
            });

            Template(noLogoScript, true, null);
            Template(noLogoScript, false, null);
        }