public void Serialize_Null() { // arrange var type = new FloatType(); // act var serializedValue = type.Serialize(null); // assert Assert.Null(serializedValue); }
public void Serialize_MaxValue_Violation() { // arrange var type = new FloatType(0, 100); double value = 123.456; // act // assert Assert.Throws <ScalarSerializationException>( () => type.Serialize(value)); }
public void Serialize_Wrong_Type_Throws() { // arrange var type = new FloatType(); var input = "abc"; // act // assert Assert.Throws <ScalarSerializationException>( () => type.Serialize(input)); }
public void Serialize_Type() { // arrange var type = new FloatType(); double value = 123.456; // act var serializedValue = type.Serialize(value); // assert Assert.IsType <double>(serializedValue); Assert.Equal(value, serializedValue); }
public void Serialize_Float() { // arrange FloatType type = new FloatType(); float input = 1.0f; // act object serializedValue = type.Serialize(input); // assert Assert.IsType <float>(serializedValue); Assert.Equal(1.0f, serializedValue); }
public void Serialize_Double() { // arrange FloatType type = new FloatType(); double input = 1.0d; // act object serializedValue = type.Serialize(input); // assert Assert.IsType <double>(serializedValue); Assert.Equal(1.0d, serializedValue); }