public void ReturnsASpecialCaseStringForThePreviousDay() { var date = now.AddDays(-1); var result = DateToTitleString.Convert(date, now); result.Should().Be(Resources.Yesterday); }
public void ReturnsASpecialCaseStringForTheCurrentDay() { var date = now; var result = DateToTitleString.Convert(date, now); result.Should().Be(Resources.Today); }
public Property ReturnsAFormattedStringForAnyOtherDate() { var arb = Arb.Default.DateTimeOffset().Filter(d => d < now.AddDays(-1)); return(Prop.ForAll(arb, date => { var result = DateToTitleString.Convert(date, now); var expectedCulture = CultureInfo.CreateSpecificCulture("en-US"); result.Should().Be(date.ToLocalTime().ToString("ddd, dd MMM", expectedCulture)); })); }
protected override void UpdateView() { if (Item.Count == 0) { return; } var firstItem = Item.First(); mainLogHeaderTitle.Text = DateToTitleString.Convert(firstItem.StartTime.Date); var totalDuration = Item.Sum(vm => vm.Duration); mainLogHeaderDuration.Text = totalDuration.ToFormattedString(firstItem.DurationFormat); }
private void updateView() { if (items.Count == 0) { return; } var firstItem = items.First(); DateLabel.Text = DateToTitleString.Convert(firstItem.StartTime, now); var totalDuration = items.Sum(vm => vm.Duration); DurationLabel.Text = totalDuration.ToFormattedString(firstItem.DurationFormat); }
public string HeaderDate(DateTimeOffset now) => DateToTitleString.Convert(headerDate, now);