public void ParseValue_Wrong_Value_Throws() { // arrange var type = new FloatType(); var value = "123"; // act // assert Assert.Throws <ScalarSerializationException>( () => type.ParseValue(value)); }
public void ParseValue_Nullable() { // arrange var type = new FloatType(); double?input = 123; // act FloatValueNode output = (FloatValueNode)type.ParseValue(input); // assert Assert.Equal(123, output.ToDouble()); }
public void ParseValue_Null() { // arrange var type = new FloatType(); object input = null; // act object output = type.ParseValue(input); // assert Assert.IsType <NullValueNode>(output); }
public void ParseValue_MinValue_Violation() { // arrange var type = new FloatType(1, 100); double input = 0; // act Action action = () => type.ParseValue(input); // assert Assert.Throws <ScalarSerializationException>(action); }
public void ParseValue_MinValue() { // arrange var type = new FloatType(1, 100); double input = 1; // act var literal = (FloatValueNode)type.ParseValue(input); // assert Assert.Equal(1, literal.ToDouble()); }
public void ParseValue_Double() { // arrange FloatType type = new FloatType(); double input = 1.0d; string expectedLiteralValue = "1.000000e+000"; // act FloatValueNode literal = (FloatValueNode)type.ParseValue(input); // assert Assert.Equal(expectedLiteralValue, literal.Value); }