public void PublishersTasksListCloneTest( )
        {
            PublishersTasksList tasks = new PublishersTasksList("tasks");
            NullTask            t     = new NullTask( );

            tasks.Add(t);
            PublishersTasksList tasksClone = tasks.Clone( ) as PublishersTasksList;

            Assert.IsNotNull(tasksClone, "Tasks Clone is Null");
            Assert.IsNotEmpty(tasksClone, "Tasks Clone is Empty");
        }
Example #2
0
 private void OnLockDatabase()
 {
     //app tasks are assumed to be finished/cancelled when the database is locked
     AppTask = new NullTask();
     //in case we are the foreground activity, we won't get OnResume (in contrast to having other activities on top of us on the stack).
     //Call it to ensure we switch to QuickUnlock/fileselect
     if (_isForeground)
     {
         OnResume();
     }
 }
        public void PrebuildsListCloneTest( )
        {
            PrebuildsList tasks = new PrebuildsList( );
            NullTask      t     = new NullTask( );

            tasks.Add(t);
            PrebuildsList tasksClone = tasks.Clone( ) as PrebuildsList;

            Assert.IsNotNull(tasksClone, "Tasks Clone is Null");
            Assert.IsNotEmpty(tasksClone, "Tasks Clone is Empty");
            Console.WriteLine("Task Clone Count = {0}", tasksClone.Count);
        }
        public void CloneableListCloneTest( )
        {
            CloneableList <PublisherTask> tasks = new CloneableList <PublisherTask> ( );
            NullTask t = new NullTask();

            tasks.Add(t);

            CloneableList <PublisherTask> tasksClone = tasks.Clone( );

            tasks.Remove(t);
            Assert.IsNotNull(tasksClone, "Tasks Clone is Null");
            Assert.IsNotEmpty(tasksClone, "Tasks Clone is Empty");
            Console.WriteLine("Task Clone Count = {0}", tasksClone.Count);
        }
Example #5
0
        public void CheckRequiredTest( )
        {
            NullTask task = new NullTask( );

            // check alienbrain
            try {
                Assert.IsNotNull(Util.CheckRequired(task, "alienbrainUri", new AlienbrainUri("ab://google.com")));
                Assert.IsNotNull(Util.CheckRequired(task, "alienbrainUri", new AlienbrainUri("alienbrain://google.com")));
            } catch (Exception exception) {
                Assert.Fail(exception.Message);
            }

            try {
                Util.CheckRequired(task, "alienbrainUri", new AlienbrainUri("http://google.com"));
                Assert.Fail("http scheme not allowed. Should have failed.");
            } catch (Exception exception) {
                Assert.IsAssignableFrom(typeof(UriFormatException), exception);
            }

            // check valid values
            try {
                Assert.IsNotNull(Util.CheckRequired(task, "object", new object( )));
                Assert.IsNotEmpty(Util.CheckRequired(task, "string", "some string"));
                Assert.Greater(Util.CheckRequired(task, "DateTime", DateTime.Now), DateTime.MinValue);
                HiddenPassword hp = new HiddenPassword( );
                hp.Password = "******";
                Assert.IsNotNull(Util.CheckRequired(task, "HiddenPassword", hp));
            } catch (Exception exception) {
                Assert.Fail(exception.Message);
            }

            //check invalid values
            try {
                Assert.IsNull(Util.CheckRequired(task, "NotificationType", (Core.Enums.NotificationType? )null));
                Assert.LessOrEqual(Util.CheckRequired(task, "CloneableList", new CloneableList <string> ( )).Count, 0);
            } catch { }
        }
Example #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.open_db_selection);

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

            SetSupportActionBar(toolbar);

            SupportActionBar.Title = GetString(Resource.String.select_database);


            //only load the AppTask if this is the "first" OnCreate (not because of kill/resume, i.e. savedInstanceState==null)
            // and if the activity is not launched from history (i.e. recent tasks) because this would mean that
            // the Activity was closed already (user cancelling the task or task complete) but is restarted due recent tasks.
            // Don't re-start the task (especially bad if tak was complete already)
            if (Intent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory))
            {
                AppTask = new NullTask();
            }
            else
            {
                AppTask = AppTask.GetTaskInOnCreate(savedInstanceState, Intent);
            }

            _adapter = new OpenDatabaseAdapter(this);
            var gridView = FindViewById <GridView>(Resource.Id.gridview);

            gridView.Adapter = _adapter;

            if (!string.IsNullOrEmpty(Intent.GetStringExtra(Util.KeyFilename)))
            {
                //forward to password activity
                Intent           i   = new Intent(this, typeof(PasswordActivity));
                IOConnectionInfo ioc = new IOConnectionInfo();
                Util.SetIoConnectionFromIntent(ioc, Intent);
                Util.PutIoConnectionToIntent(ioc, i);
                i.PutExtra(PasswordActivity.KeyKeyfile, i.GetStringExtra(PasswordActivity.KeyKeyfile));
                i.PutExtra(PasswordActivity.KeyPassword, i.GetStringExtra(PasswordActivity.KeyPassword));
                LaunchingOther = true;
                StartActivityForResult(i, ReqCodeOpenNewDb);
            }
            else
            {
                if (Intent.Action == Intent.ActionView)
                {
                    GetIocFromViewIntent(Intent);
                }
                else if (Intent.Action == Intent.ActionSend)
                {
                    AppTask = new SearchUrlTask {
                        UrlToSearchFor = Intent.GetStringExtra(Intent.ExtraText)
                    };
                }
            }

            _intentReceiver = new MyBroadcastReceiver(this);
            IntentFilter filter = new IntentFilter();

            filter.AddAction(Intents.DatabaseLocked);
            RegisterReceiver(_intentReceiver, filter);
        }
Example #7
0
        public override Task Clone()
        {
            var result = new NullTask();

            return(result);
        }
 public void Setup()
 {
     task = new NullTask();
 }