public void Serialize_String_Exception() { // arrange var timeSpanType = new TimeSpanType(); // act Action a = () => timeSpanType.Serialize("bad"); // assert Assert.Throws <ScalarSerializationException>(a); }
public void Serialize_Null() { // arrange var timeSpanType = new TimeSpanType(); // act object serializedValue = timeSpanType.Serialize(null); // assert Assert.Null(serializedValue); }
public void Serialize_TimeSpan_Min(TimeSpanFormat format, string expectedValue) { // arrange var timeSpanType = new TimeSpanType(format); TimeSpan timeSpan = TimeSpan.MinValue; // act string serializedValue = (string)timeSpanType.Serialize(timeSpan); // assert Assert.Equal(expectedValue, serializedValue); }
public void Serialize_TimeSpan_DefaultFormat() { // arrange var timeSpanType = new TimeSpanType(); var timeSpan = TimeSpan.FromMinutes(5); string expectedValue = "PT5M"; // act string serializedValue = (string)timeSpanType.Serialize(timeSpan); // assert Assert.Equal(expectedValue, serializedValue); }