Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar(toolbar);

            SupportActionBar.Title = "Hello from Appcompat Toolbar";

            rivet = new Rivet(this, Rivet.DeveloperSpid);

            Button createBtn = FindViewById <Button>(Resource.Id.createkey);
            Button pairBtn   = FindViewById <Button>(Resource.Id.pair);
            Button signBtn   = FindViewById <Button>(Resource.Id.sign);
            Button deleteBtn = FindViewById <Button>(Resource.Id.delete);

            createBtn.Click += CreateBtn_Click;
            pairBtn.Click   += PairBtn_Click;
            signBtn.Click   += SignBtn_Click;
            deleteBtn.Click += deleteBtn_Click;
        }
Exemplo n.º 2
0
        public void CombiningSpecifications()
        {
            Rivet task = null;
            "Given new Rivet task".Context(() => task = new Rivet {BuildEngine = new FakeBuildEngine()});

            "Execute returns false when invoked with invalid parameters".Assert(() => task.Execute().ShouldBeFalse());

            "when Execute is invoked with parameters \"<path-to-dir> -v:debug=false -v:trace=true\", javascript files in the target directory are combined"
                .Assert(() =>
                            {
                                using (var tempDirectory = new TempDirectory())
                                {
                                    /* create filesystem strucure:
                                     * %TEMP%\main.js
                                     * %TEMP%\secondary.js
                                     * %TEMP%\dirWithComponentFile\include.js
                                     * %TEMP%\dirWithStandaloneFile\standalone.js
                                     * %TEMP%\dirWithNestedComponentFiles\include.js
                                     * %TEMP%\dirWithNestedComponentFiles\subdir\include.js
                                     * %TEMP%\dirWithNestedComponentFilesAndStandaloneFile\include.js
                                     * %TEMP%\dirWithNestedComponentFilesAndStandaloneFile\standalone.js
                                     * %TEMP%\dirWithNestedComponentFilesAndStandaloneFile\subdir\include.js
                                     * %TEMP%\dirWithNestedComponentFilesAndStandaloneFile2\include.js
                                     * %TEMP%\dirWithNestedComponentFilesAndStandaloneFile2\subdir\include.js
                                     * %TEMP%\dirWithNestedComponentFilesAndStandaloneFile2\subdir\standalone.js
                                     */

                                    tempDirectory.CreateFile("main.js", @"@rivet
                                                                            includes.push(""dirWithComponentFile/include.js"");
                                                                            includes.push(""dirWithNestedComponentFiles/include.js"");
                                                                            includes.push(""dirWithNestedComponentFiles/subdir/include.js"");
                                                                            includes.push(""dirWithNestedComponentFilesAndStandaloneFile/include.js"");
                                                                            includes.push(""dirWithNestedComponentFilesAndStandaloneFile/subdir/include.js"");
                                                                            includes.push(""dirWithNestedComponentFilesAndStandaloneFile2/include.js"");
                                                                            includes.push(""dirWithNestedComponentFilesAndStandaloneFile2/subdir/include.js"");
                                                                        ");

                                    tempDirectory.CreateFile("secondary.js", @"@rivet
                                                                            includes.push(""dirWithNestedComponentFiles/subdir/include.js"");
                                                                            includes.push(""dirWithNestedComponentFilesAndStandaloneFile/include.js"");
                                                                            includes.push(""dirWithNestedComponentFilesAndStandaloneFile/subdir/include.js"");
                                                                            includes.push(""dirWithNestedComponentFilesAndStandaloneFile2/include.js"");
                                                                        ");

                                    tempDirectory.CreateDirectory("dirWithComponentFile");
                                    tempDirectory.CreateFile("dirWithComponentFile\\include.js", "BEFORE\r\n//##DEBUG_STARTTEST\r\n//##DEBUG_ENDAFTER\r\n");

                                    tempDirectory.CreateDirectory("dirWithStandaloneFile");
                                    tempDirectory.CreateFile("dirWithStandaloneFile\\standalone.js", "standalone js file");

                                    tempDirectory.CreateDirectory("dirWithNestedComponentFiles");
                                    tempDirectory.CreateFile("dirWithNestedComponentFiles\\include.js", "BEFORE_LINE\r\nTHIS_SHOULD_BE_REMOVED;//##DEBUGAFTER_LINE\r\n");
                                    tempDirectory.CreateDirectory("dirWithNestedComponentFiles\\subdir");
                                    tempDirectory.CreateFile("dirWithNestedComponentFiles\\subdir\\include.js", "A");

                                    tempDirectory.CreateDirectory("dirWithNestedComponentFilesAndStandaloneFile");
                                    tempDirectory.CreateFile("dirWithNestedComponentFilesAndStandaloneFile\\include.js", "B");
                                    tempDirectory.CreateFile("dirWithNestedComponentFilesAndStandaloneFile\\standalone.js", "standalone js file");
                                    tempDirectory.CreateDirectory("dirWithNestedComponentFilesAndStandaloneFile\\subdir");
                                    tempDirectory.CreateFile("dirWithNestedComponentFilesAndStandaloneFile\\subdir\\include.js", "C");

                                    tempDirectory.CreateDirectory("dirWithNestedComponentFilesAndStandaloneFile2");
                                    tempDirectory.CreateFile("dirWithNestedComponentFilesAndStandaloneFile2\\include.js", "D");
                                    tempDirectory.CreateDirectory("dirWithNestedComponentFilesAndStandaloneFile2\\subdir");
                                    tempDirectory.CreateFile("dirWithNestedComponentFilesAndStandaloneFile2\\subdir\\include.js", "var i = @VARIABLE_1;var j = @VARIABLE_2;");
                                    tempDirectory.CreateFile("dirWithNestedComponentFilesAndStandaloneFile2\\subdir\\standalone.js", "standalone js file");

                                    task.TargetDirectory = tempDirectory.Path;
                                    task.Variables = "VARIABLE_1=false;VARIABLE_2=true";
                                    task.Execute().ShouldBeTrue();

                                    tempDirectory.ReadFile("main.js").ShouldEqual("BEFORE\r\nAFTER\r\nBEFORE_LINEAFTER_LINE\r\nABCDvar i = false;var j = true;");
                                    tempDirectory.ReadFile("secondary.js").ShouldEqual("ABCD");

                                    tempDirectory.DirectoryExists("dirWithComponentFile").ShouldBeFalse();
                                    tempDirectory.FileExists("dirWithStandaloneFile\\standalone.js").ShouldBeTrue();
                                    tempDirectory.DirectoryExists("dirWithNestedComponentFiles").ShouldBeFalse();
                                    tempDirectory.FileExists("dirWithNestedComponentFilesAndStandaloneFile\\standalone.js").ShouldBeTrue();
                                    tempDirectory.DirectoryExists("dirWithNestedComponentFilesAndStandaloneFile\\subdir").ShouldBeFalse();
                                    tempDirectory.DirectoryExists("dirWithNestedComponentFilesAndStandaloneFile2\\subdir").ShouldBeTrue();
                                }
                            });
        }