Exemplo n.º 1
0
        /// <inheritdoc/>
        public object Transform(string inputFile, string preferedOutputFormat)
        {
            if (preferedOutputFormat == null)
            {
                throw new ArgumentNullException(nameof(preferedOutputFormat));
            }

            var extension = Path.GetExtension(inputFile);

            object result = null;

            switch (extension.Substring(1))
            {
            case "cs":
                var cSharpTransform = new CSharpTransform(inputFile);

                if (preferedOutputFormat.Equals("xml", StringComparison.Ordinal))
                {
                    result = cSharpTransform.TransformToXml();
                }

                break;

            default:
                result = "#ERR# No valid format #ERR#";
                break;
            }

            return(result);
        }
 public void QueryPerformance()
 {
     for (var j = 0; j < 100; j++)
     {
         var start = DateTime.Now;
         for (var i = 0; i < 10000; i++)
         {
             String output = CSharpTransform.transform("sirap");
         }
         var stop          = DateTime.Now;
         var executionTime = stop - start;
         Console.WriteLine(executionTime.TotalMilliseconds);
     }
     Assert.True(true);
 }
        public void Fail()
        {
            String output = CSharpTransform.transform("Abc123");

            Assert.False(output.Equals("321bA"));
        }
        public void Pass()
        {
            String output = CSharpTransform.transform("Abc123");

            Assert.True(output.Equals(output));
        }