public void ThrowsFormatExceptionOnInvalidDateFormat() { // Creating the xml string xml = @"<test> <date>njsk</date> </test>"; // Creating the model var model = new DateTimeFormatTestModel(); // Extracting Contents model.Extract(xml); }
public void DateTimeEndsWith_HHMM_Format_TimeZone_PDT_Success() { // Creating the xml string xml = @"<test> <date>Monday, 7 September 2015 20:00:00 -0700</date> </test>"; // Creating the model var model = new DateTimeFormatTestModel(); // Extracting Contents model.Extract(xml); // Checking Result Assert.AreEqual(model.Date, new DateTime(2015, 9, 8, 8, 30, 00)); Assert.IsTrue(model.NullableDate.HasValue); Assert.AreEqual(model.NullableDate.Value, new DateTime(2015, 9, 8, 8, 30, 00)); }