Ejemplo n.º 1
0
        public void Should_run_callback_on_load()
        {
            var check = false;

            _model.Load(() => check = true);

            Assert.IsTrue(check);
        }
Ejemplo n.º 2
0
        public void Should_get_different_results_for_different_time_periods()
        {
            var model1 = new TopCommitters();

            model1.TimePeriod = TimePeriod.PastDay;
            model1.Load(() => { });
            var list1 = model1.Committers;

            model1.TimePeriod = TimePeriod.PastWeek;
            model1.Load(() => { });
            var list2 = model1.Committers;

            CollectionAssert.AreNotEqual(list1, list2);
        }
 public void Refresh()
 {
     InvokeOnMainThread(LoadingIndicator.Instance.StartLoading);
     model.Load(() => {
         InvokeOnMainThread(UpdateUI);
         InvokeOnMainThread(LoadingIndicator.Instance.StopLoading);
     });
 }
Ejemplo n.º 4
0
 public void Refresh()
 {
     _model.Load(() => ((Activity)Context).RunOnUiThread(() =>
     {
         UpdateListView();
         OnDescriptionChanged(new EventArgs());
     }));
     _lastRefreshTime = DateTime.Now;
 }
Ejemplo n.º 5
0
        public void Should_be_able_to_fetch_and_parse_service_when_server_is_running_on_localhost()
        {
            var persistance = new FakePersistenceService();

            SmeedeeApp.Instance.ServiceLocator.Bind <IPersistenceService>(persistance);
            SmeedeeApp.Instance.ServiceLocator.Bind <IBackgroundWorker>(new NoBackgroundInvocation());
            SmeedeeApp.Instance.ServiceLocator.Bind <ITopCommittersService>(new TopCommittersService());
            persistance.Save("Login_Url", "http://localhost:1155/Smeedee");

            var model = new TopCommitters();

            model.Load(() => { });
            Assert.AreNotEqual(0, model.Committers.Count());
        }
        public void LoadData()
        {
            model.TimePeriod = TimePeriod.PastWeek;
            IsLoading        = true;
            model.Load(() => Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                Items.Clear();
                foreach (var committer in model.Committers)
                {
                    var commitPercent = Convert.ToInt32((committer.Commits / (float)model.Committers.First().Commits) * 100);

                    Items.Add(new TopCommittersItemViewModel
                    {
                        Name          = committer.Name,
                        Commits       = committer.Commits + "",
                        Image         = committer.ImageUri,
                        CommitPercent = commitPercent.ToString()
                    });
                }
                IsLoading = false;
            }));
        }