Beispiel #1
0
        public void None()
        {
            date = new DateOffset(null, null, null);
            var str = DateOffsetFormatter.GetPartialDateString(date);

            Assert.AreEqual("", str);
        }
Beispiel #2
0
        public void Day()
        {
            date = new DateOffset(null, null, now.Day);
            var str = DateOffsetFormatter.GetPartialDateString(date);

            Assert.AreEqual(now.ToString("d MMMM yyyy"), str);
        }
Beispiel #3
0
        public void Month()
        {
            date = new DateOffset(null, now.Month, null);

            var str = DateOffsetFormatter.GetPartialDateString(date);

            Assert.AreEqual(now.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthNames[now.Month - 1].ToLower() + " yyyy"), str);
        }
Beispiel #4
0
        public void Year()
        {
            date = new DateOffset(now.Year, null, null);

            var str = DateOffsetFormatter.GetPartialDateString(date);

            Assert.AreEqual(now.ToString("yyyy"), str);
        }
Beispiel #5
0
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var d = value as DateOffset;

            if (d == null)
            {
                return(DependencyProperty.UnsetValue);
            }

            return(DateOffsetFormatter.GetPartialDateString(d));
        }
Beispiel #6
0
 public override string ToString()
 {
     return(DateOffsetFormatter.GetPartialDateString(sourceDo));
 }