public void Serialize_String_Exception() { // arrange DateType dateType = new DateType(); // act Action a = () => dateType.Serialize("foo"); // assert Assert.Throws <ArgumentException>(a); }
public void Serialize_Null() { // arrange DateType dateType = new DateType(); // act object serializedValue = dateType.Serialize(null); // assert Assert.Null(serializedValue); }
public void Serialize_String_Exception() { // arrange var dateType = new DateType(); // act Action a = () => dateType.Serialize("foo"); // assert Assert.Throws <ScalarSerializationException>(a); }
public void Serialize_Date() { // arrange DateType dateType = new DateType(); DateTime dateTime = new DateTime( 2018, 6, 11, 8, 46, 14, DateTimeKind.Utc); string expectedValue = "2018-06-11"; // act string serializedValue = (string)dateType.Serialize(dateTime); // assert Assert.Equal(expectedValue, serializedValue); }
public void Serialize_DateTimeOffset() { // arrange DateType dateType = new DateType(); DateTimeOffset dateTime = new DateTimeOffset( new DateTime(2018, 6, 11, 8, 46, 14), new TimeSpan(4, 0, 0)); string expectedValue = "2018-06-11"; // act string serializedValue = (string)dateType.Serialize(dateTime); // assert Assert.Equal(expectedValue, serializedValue); }