public void ExposesCommandToOpenLinkInBrowser()
        {
            var pipelineReportVM = new PipelineReportViewModel(_pipeline);

            Assert.IsNotNull(pipelineReportVM.OpenLinkCommand);
            Assert.IsInstanceOf<ActionCommand>(pipelineReportVM.OpenLinkCommand);
        }
        public void CanShowSuccessfulBuild()
        {
            var successfulPipeline = new PipelineReport()
                                         {
                                             Activity = Activity.Idle,
                                             BuildState = BuildState.Success,
                                             LastBuildTime = DateTime.Now,
                                             LinkURL = "http://ci:8153/go/pipelines/jimbo",
                                             Name = "CI-Trunk"
                                         };

            var pipelineReportVM = new PipelineReportViewModel(successfulPipeline);
            Assert.AreEqual("Success", pipelineReportVM.PipelineState);
        }
        public void CanShowFailedBuild()
        {
            var failedPipeline = new PipelineReport()
            {
                Activity = Activity.Idle,
                BuildState = BuildState.Failure,
                LastBuildTime = DateTime.Now,
                LinkURL = "http://ci:8153/go/pipelines/jimbo",
                Name = "CI-Trunk"
            };

            var pipelineReportVM = new PipelineReportViewModel(failedPipeline);
            Assert.AreEqual("Failure", pipelineReportVM.PipelineState);
        }
        public void LastBuildTimeOver24Hours()
        {
            _pipeline.LastBuildTime = DateTime.Now.AddHours(-100);
            var pipelineReportVM = new PipelineReportViewModel(_pipeline);

            Assert.AreEqual("over 4 days ago", pipelineReportVM.LastBuildTime);
        }
        public void ExposesURL()
        {
            var pipelineReportVM = new PipelineReportViewModel(_pipeline);

            Assert.AreEqual("http://ci:8153/go/pipelines/jimbo", pipelineReportVM.URL);
        }
        public void ExposesName()
        {
            var pipelineReportVM = new PipelineReportViewModel(_pipeline);

            Assert.AreEqual("CI-Trunk", pipelineReportVM.Name);
        }
        public void LastBuildTimeUnderAnHourToNearest5()
        {
            _pipeline.LastBuildTime = DateTime.Now.AddMinutes(-46);
            var pipelineReportVM = new PipelineReportViewModel(_pipeline);

            Assert.AreEqual("about 45 minutes ago", pipelineReportVM.LastBuildTime);
        }
        public void LastBuildTimeUnder60Seconds()
        {
            _pipeline.LastBuildTime = DateTime.Now.AddSeconds(-10);
            var pipelineReportVM = new PipelineReportViewModel(_pipeline);

            Assert.AreEqual("under a minute ago", pipelineReportVM.LastBuildTime);
        }
        public void LastBuildTimeUnder2Hours()
        {
            _pipeline.LastBuildTime = DateTime.Now.AddMinutes(-75);
            var pipelineReportVM = new PipelineReportViewModel(_pipeline);

            Assert.AreEqual("about an hour ago", pipelineReportVM.LastBuildTime);
        }
        public void LastBuildTimeUnder24Hours()
        {
            _pipeline.LastBuildTime = DateTime.Now.AddHours(-23);
            var pipelineReportVM = new PipelineReportViewModel(_pipeline);

            Assert.AreEqual("about 23 hours ago", pipelineReportVM.LastBuildTime);
        }