public void prints_float_value() { double value = 3.33; var val = new GraphQLFloatValue(value); var result = val.Print(); result.ShouldBe(value.ToString("0.0##", NumberFormatInfo.InvariantInfo)); }
public void BadFloatValues() { var type = new FloatGraphType(); var value1 = new GraphQLFloatValue(_maxNumber); var value2 = new GraphQLFloatValue(_minNumber); type.CanParseLiteral(value1).ShouldBeFalse(); type.CanParseLiteral(value2).ShouldBeFalse(); Should.Throw <InvalidOperationException>(() => type.ParseLiteral(value1)).Message.ShouldStartWith("Unable to convert '1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0' literal from AST representation to the scalar type 'Float'"); Should.Throw <InvalidOperationException>(() => type.ParseLiteral(value2)).Message.ShouldStartWith("Unable to convert '-1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0' literal from AST representation to the scalar type 'Float'"); }