public Convert ( object value, |
||
value | object | |
targetType | ||
parameter | object | |
culture | ||
Результат | object |
public void DateTimeToStringConverter_Convert_ValueNotDateTime_NoStringReturned() { //------------Setup for test-------------------------- var dateTimeToStringConverter = new DateTimeToStringConverter(); //------------Execute Test--------------------------- var convertedValue = dateTimeToStringConverter.Convert("some data", null, null, null); //------------Assert Results------------------------- Assert.IsNotInstanceOfType(convertedValue, typeof(string)); }
public void DateTimeToStringConverter_Convert_HasDateTimeValue_StringWithSplitSeconds() { //------------Setup for test-------------------------- var dateTimeToStringConverter = new DateTimeToStringConverter(); var dateTimeToConvert = new DateTime(2014, 01, 02, 10, 15, 52, 52); //------------Execute Test--------------------------- var convertedValue = dateTimeToStringConverter.Convert(dateTimeToConvert, null, null, null); //------------Assert Results------------------------- Assert.AreEqual("2014/01/02 10:15:52.0520 AM", convertedValue); }
public void DateTimeToStringConverter_Convert_HasFormat_StringUsingProvidedFormat() { //------------Setup for test-------------------------- var dateTimeToStringConverter = new DateTimeToStringConverter(); dateTimeToStringConverter.Format = "dd/MMM/yyyy"; var dateTimeToConvert = new DateTime(2014, 01, 02, 10, 15, 52, 52); //------------Execute Test--------------------------- var convertedValue = dateTimeToStringConverter.Convert(dateTimeToConvert, null, null, null); //------------Assert Results------------------------- Assert.AreEqual("02/Jan/2014", convertedValue); }