Exemplo n.º 1
0
            public void Should_correctly_identify_and_present_number_of_builds_for_each_status()
            {
                var model = new BuildStatus();

                buildStatusService.Builds = buildStatusService.DefaultBuilds;
                model.Load(() => Assert.AreEqual("3 working, 2 broken, 3 unknown builds", model.DynamicDescription));
            }
        public void LoadData()
        {
            IsLoading = true;
            model.Load(() => Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                Items.Clear();
                foreach (var build in model.Builds)
                {
                    var statusImageUri = "";

                    if (build.BuildSuccessState == BuildState.Broken)
                    {
                        statusImageUri = "../Resources/Images/redx.png";
                    }
                    if (build.BuildSuccessState == BuildState.Working)
                    {
                        statusImageUri = "../Resources/Images/checkmark.png";
                    }
                    if (build.BuildSuccessState == BuildState.Unknown)
                    {
                        statusImageUri = "../Resources/Images/questionmark.png";
                    }

                    Items.Add(new BuildStatusItemViewModel
                    {
                        ProjectName      = build.ProjectName,
                        UserName         = build.Username,
                        BuildTime        = (DateTime.Now - build.BuildTime).PrettyPrint(),
                        BuildStatusImage = statusImageUri
                    });
                }
                IsLoading = false;
            }));
        }
Exemplo n.º 3
0
 public void Refresh()
 {
     InvokeOnMainThread(LoadingIndicator.Instance.StartLoading);
     model.Load(() => {
         InvokeOnMainThread(UpdateUI);
         InvokeOnMainThread(LoadingIndicator.Instance.StopLoading);
     });
 }
Exemplo n.º 4
0
            public void Should_invoke_callback()
            {
                var model          = new BuildStatus();
                var hasBeenInvoked = false;

                model.Load(() => hasBeenInvoked = true);

                Assert.True(hasBeenInvoked);
            }
Exemplo n.º 5
0
            public void Should_correctly_present_all_builds_working()
            {
                var model = new BuildStatus();

                buildStatusService.Builds = new List <Build>()
                {
                    new Build("foo", BuildState.Working, "fooname", DateTime.Now), new Build("bar", BuildState.Working, "barname", DateTime.Now)
                };
                model.Load(() => Assert.AreEqual("2 working builds", model.DynamicDescription));
            }
Exemplo n.º 6
0
            public void Should_correctly_present_all_builds_broken()
            {
                var model = new BuildStatus();

                buildStatusService.Builds = new List <Build>()
                {
                    new Build("foo", BuildState.Broken, "fooname", DateTime.Now),
                    new Build("bar", BuildState.Broken, "barname", DateTime.Now)
                };
                model.Load(() => Assert.AreEqual("OMG! All builds are broken!", model.DynamicDescription));
            }
Exemplo n.º 7
0
        public void Refresh()
        {
            model.Load(() =>
                       ((Activity)Context).RunOnUiThread(() =>
            {
                buildList.Adapter = new BuildStatusAdapter(
                    Context,
                    GetListAdapterFromBuildModels(),
                    Resource.Layout.BuildStatusWidget_ListItem,
                    listItemMappingFrom,
                    listItemMappingTo);

                OnDescriptionChanged(new EventArgs());
            }));
            _lastRefreshTime = DateTime.Now;
        }
Exemplo n.º 8
0
            public void Should_report_correct_amount_of_unknown_builds()
            {
                var model = new BuildStatus();

                model.Load(() => Assert.AreEqual(3, model.GetNumberOfBuildsByState(BuildState.Unknown)));
            }
Exemplo n.º 9
0
            public void Should_properly_put_broken_builds_at_top_when_sorting_by_time()
            {
                BuildStatus model = GetTimeSortedModelWithBrokenAtTop();

                model.Load(() => Assert.True(model.Builds.Take(2).Where(b => b.BuildSuccessState == BuildState.Broken).Count() == 2));
            }
Exemplo n.º 10
0
            public void Should_properly_order_builds_by_build_time()
            {
                BuildStatus model = GetTimeSortedModel();

                model.Load(() => Assert.AreEqual(model.Builds.OrderByDescending(b => b.BuildTime), model.Builds));
            }