public void AsBuildStatusListViewItem_InProgressNoPreviousDuration_DurationCountsUp()
 {
     BuildStatus buildStatus = new BuildStatus
     {
         BuildDefinitionId = "MyBuild",
         LocalStartTime = new DateTime(2010, 1, 1, 1, 1, 1),
         BuildStatusEnum = BuildStatusEnum.InProgress
     };
     var now = new DateTime(2010, 1, 1, 1, 2, 2);
     var previousWorkingOrBrokenBuildStatus = new Dictionary<string, BuildStatus>();
     var settings = new SirenOfShameSettingsFake();
     var result = buildStatus.AsBuildStatusDto(now, previousWorkingOrBrokenBuildStatus, settings);
     Assert.AreEqual("1:01", result.Duration);
 }
 public void AsBuildStatusListViewItem_InProgressPreviousRunOneMinuteBuildJustStarted_DurationCountsDown()
 {
     BuildStatus buildStatus = new BuildStatus
     {
         BuildDefinitionId = "MyBuild",
         LocalStartTime = new DateTime(2010, 1, 1, 1, 1, 1),
         BuildStatusEnum = BuildStatusEnum.InProgress
     };
     var now = new DateTime(2010, 1, 1, 1, 1, 1);
     var previousWorkingOrBrokenBuildStatus = new Dictionary<string, BuildStatus>
     {
         { "MyBuild", new BuildStatus
         {
             StartedTime = new DateTime(2010, 1, 1, 1, 1, 0),
             FinishedTime = new DateTime(2010, 1, 1, 1, 2, 0)
         } }
     };
     var settings = new SirenOfShameSettingsFake();
     var result = buildStatus.AsBuildStatusDto(now, previousWorkingOrBrokenBuildStatus, settings);
     Assert.AreEqual("1:00", result.Duration); // would have been 0:00 if counting up
 }
        public void AsBuildStatusListViewItem_InProgressBuildRunningOverPreviousRunDuration_DurationCountsUpOvertime()
        {
            // current duration: 2 minute, 1 second
            BuildStatus buildStatus = new BuildStatus
            {
                BuildDefinitionId = "MyBuild",
                LocalStartTime = new DateTime(2010, 1, 1, 1, 1, 1),
                BuildStatusEnum = BuildStatusEnum.InProgress
            };
            var now = new DateTime(2010, 1, 1, 1, 3, 2);

            // previous duration 1 minute
            var previousWorkingOrBrokenBuildStatus = new Dictionary<string, BuildStatus>
            {
                { "MyBuild", new BuildStatus
                {
                    StartedTime = new DateTime(2010, 1, 1, 1, 1, 0),
                    FinishedTime = new DateTime(2010, 1, 1, 1, 2, 0)
                } }
            };
            var settings = new SirenOfShameSettingsFake();
            var result = buildStatus.AsBuildStatusDto(now, previousWorkingOrBrokenBuildStatus, settings);
            Assert.AreEqual("OT: 1:01", result.Duration);
        }