Exemplo n.º 1
0
        public void ProcessNoParameter()
        {
            ConvoarParams parms           = new ConvoarParams();
            string        outputDirectory = "this/that";

            string[] args = new string[] {
                "-d", outputDirectory,
                "--noExportTextures",
                "--preferredTextureFormat", "GIF",
            };
            parms.SetParameterValue("ExportTextures", "true");

            Exception exceptionCode = null;

            try {
                parms.MergeCommandLine(args);
            }
            catch (Exception e) {
                exceptionCode = e;
            }

            if (exceptionCode != null)
            {
                Assert.Fail("Exception merging parameters: " + exceptionCode.ToString());
            }
            else
            {
                Assert.AreEqual(false, parms.P <bool>("ExportTextures"), "ExportTextures was not set to false");
            }
        }
Exemplo n.º 2
0
        public void ProcessArgsParameter()
        {
            bool   oldExportTextures         = _params.P <bool>("ExportTextures");
            string inputOARFileParameterName = "InputOAR";
            string inputOARFile    = "AnOARFileToRead.oar";
            string outputDirectory = "this/that";

            string[] args = new string[] {
                "-d", outputDirectory,
                "--exporttextures",
                "--preferredTextureFormat", "GIF",
                "--mergeStaticMeshes",
                "--verticesmaxForBuffer", "1234",
                inputOARFile
            };
            _params.SetParameterValue("ExportTextures", "false");
            _params.SetParameterValue("MergeStaticMeshes", "false");

            Exception exceptionCode = null;

            try {
                _params.MergeCommandLine(args, null, inputOARFileParameterName);
            }
            catch (Exception e) {
                exceptionCode = e;
            }

            if (exceptionCode != null)
            {
                Assert.Fail("Exception merging parameters: " + exceptionCode.ToString());
            }
            else
            {
                Assert.AreEqual(outputDirectory, _params.P <string>("OutputDir"), "Output directory specification short form was not set");
                Assert.AreEqual(true, _params.P <bool>("ExportTextures"), "ExportTextures was not parameterized properly");
                Assert.AreEqual("GIF", _params.P <string>("PreferredTextureFormat"), "Preferred texture format was not set");
                Assert.AreEqual(true, _params.P <bool>("MergeStaticMeshes"), "MergeStaticMeshes was not set");
                Assert.AreEqual(1234, _params.P <int>("VerticesMaxForBuffer"), "VerticesMaxForBuffer was not set");
                Assert.AreEqual(inputOARFile, _params.P <string>("InputOAR"), "The trailing filename was not set");
            }
        }