예제 #1
0
        public static int Main(string[] argv)
        {
#if NETCOREAPP1_0
            return(0);
#else
            var run = new NUnitLite.AutoRun();
            return(run.Execute(argv));
#endif
        }
예제 #2
0
        public void DSA_Sil2Cil()
        {
            Model.Host    host     = new Model.Host();
            Model.ILoader provider = new CecilProvider.Loader(host);
            string        buildDir =
                Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(CecilProvider.Loader))
                                      .Location);

            // create temporary directory where we place generated dlls
            string tempDir = Utils.GetTemporaryDirectory();

            // sanity check for needed libraries
            // resourceDSALibrary is the library that is going to be processed
            // resourceDSANUnit has test cases for the DSA library
            string resourceDSALibrary = Path.Combine(buildDir, "Resources/DSA/Library/DSA.dll");
            string resourceDSANUnit   = Path.Combine(buildDir, "Resources/DSA/NUnit/DSANUnitTests.dll");

            if (!File.Exists(resourceDSALibrary) || !File.Exists((resourceDSANUnit)))
            {
                throw new FileNotFoundException();
            }

            // read the DSA library and re compile it using our framework
            provider.LoadAssembly(resourceDSALibrary);
            CodeGenerator.CecilCodeGenerator.CecilCodeGenerator exporter = new CodeGenerator.CecilCodeGenerator.CecilCodeGenerator(host);
            exporter.WriteAssemblies(tempDir);

            // copy nunit test library to temp dir
            string dsaNUnit = Path.Combine(tempDir, "DSANUnitTests.dll");

            File.Copy(resourceDSANUnit, dsaNUnit);

            // execute nunit test suite
            NUnitLite.AutoRun autoRun   = new NUnitLite.AutoRun(System.Reflection.Assembly.LoadFrom(dsaNUnit));
            string            outputTxt = Path.Combine(tempDir, "output.txt");
            string            outputCmd = "--out=" + outputTxt;

            autoRun.Execute(new string[1] {
                outputCmd
            });

            // check results
            string output = File.ReadAllText(outputTxt);

            Assert.IsTrue(output.Contains("Test Count: 618, Passed: 618"));
        }
예제 #3
0
        public static int Main(string[] args)
        {
            var runner = new NUnitLite.AutoRun(typeof(Program).Assembly);

            return(runner.Execute(args, new ColorConsoleWriter(colorEnabled: true), Console.In));
        }