Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            // tests can be inside the main assembly
            AddTest(Assembly.GetExecutingAssembly());
            // or in any reference assemblies
            // AddTest (typeof (Your.Library.TestClass).Assembly);

            // Once you called base.OnCreate(), you cannot add more assemblies.
            base.OnCreate(bundle);

            var path = FileLoadTests.GetDicosPath();

            using (var asset = Assets.Open("TestData/dicos.json.txt"))
                using (var dest = File.Create(path))
                {
                    asset.CopyTo(dest);
                }

            path = FileLoadTests.GetTinyPath();

            using (var asset = Assets.Open("TestData/tiny.json.txt"))
                using (var dest = File.Create(path))
                {
                    asset.CopyTo(dest);
                }

            path = FileLoadTests.GetHighlyNestedPath();

            using (var asset = Assets.Open("TestData/_oj-highly-nested.json.txt"))
                using (var dest = File.Create(path))
                {
                    asset.CopyTo(dest);
                }
        }
Пример #2
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app,
                                               NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow(UIScreen.MainScreen.Bounds);
            runner = new TouchRunner(window);

            // register every tests included in the main application/assembly
            runner.Add(System.Reflection.Assembly.GetExecutingAssembly());

            var path = FileLoadTests.GetDicosPath();

            var dicos = Path.Combine(
                NSBundle.MainBundle.BundlePath,
                "dicos.json.txt");

            using (var reader = new StreamReader(dicos))
                using (var writer = new StreamWriter(path))
                {
                    writer.Write(reader.ReadToEnd());
                }

            path = FileLoadTests.GetTinyPath();

            var tiny = Path.Combine(
                NSBundle.MainBundle.BundlePath,
                "tiny.json.txt");

            using (var reader = new StreamReader(tiny))
                using (var writer = new StreamWriter(path))
                {
                    writer.Write(reader.ReadToEnd());
                }

            path = FileLoadTests.GetHighlyNestedPath();

            var nested = Path.Combine(
                NSBundle.MainBundle.BundlePath,
                "_oj-highly-nested.json.txt");

            using (var reader = new StreamReader(nested))
                using (var writer = new StreamWriter(path))
                {
                    writer.Write(reader.ReadToEnd());
                }

            window.RootViewController = new UINavigationController(runner.GetViewController());

            // make the window visible
            window.MakeKeyAndVisible();

            return(true);
        }