public void Serialize_Wrong_Type_Throws() { // arrange var type = new ByteType(); var input = "abc"; // act // assert Assert.Throws <SerializationException>( () => type.Serialize(input)); }
public void Serialize_Null() { // arrange var type = new ByteType(); // act var serializedValue = type.Serialize(null); // assert Assert.Null(serializedValue); }
public void Serialize_MaxValue_Violation() { // arrange var type = new ByteType(0, 100); byte value = 200; // act // assert Assert.Throws <SerializationException>( () => type.Serialize(value)); }
public void Serialize_Type() { // arrange var type = new ByteType(); byte value = 123; // act var serializedValue = type.Serialize(value); // assert Assert.IsType <byte>(serializedValue); Assert.Equal(value, serializedValue); }