public void DeserializeEmptyDateField() { var serializer = new DateFieldSerializer(); var field = (DateField)serializer.Deserialize(null); Assert.False(field.Value.HasValue); }
public void SerializeEmptyDateField() { var serializer = new DateFieldSerializer(); var str = serializer.Serialize(new DateField()); Assert.Null(str); }
public void WrongInputToDateField() { var serializer = new DateFieldSerializer(); Assert.Throws <ArgumentException>(() => serializer.Serialize(new StringField { Value = "Exception" })); }
public void SerializeDateField() { var serializer = new DateFieldSerializer(); var str = serializer.Serialize(new DateField { Value = new DateTime(2001, 1, 5, 16, 0, 0) }); Assert.Equal("2001-01-05", str); }
public void DeserializeDateField() { var serializer = new DateFieldSerializer(); var date = new DateTime(2001, 1, 5, 16, 0, 0); var str = "2001-01-05 16:00:00"; var field = (DateField)serializer.Deserialize(str); Assert.NotNull(field); Assert.Equal(date, field.Value.Value); }