public void IsInstanceOfType_NullValueNode() { // arrange var type = new IdType(); NullValueNode input = NullValueNode.Default; // act bool result = type.IsInstanceOfType(input); // assert Assert.True(result); }
public void IsInstanceOfType_Wrong_ValueNode() { // arrange var type = new IdType(); var input = new FloatValueNode(123456.0); // act bool result = type.IsInstanceOfType(input); // assert Assert.False(result); }
public void ParseValue_String() { // arrange var type = new IdType(); object input = "hello"; // act object output = type.ParseValue(input); // assert Assert.IsType<StringValueNode>(output); }
public void IsInstanceOfType_IntValueNode() { // arrange var type = new IdType(); var input = new IntValueNode(123456); // act bool result = type.IsInstanceOfType(input); // assert Assert.True(result); }
public void ParseLiteral_NullValueNode() { // arrange var type = new IdType(); NullValueNode input = NullValueNode.Default; // act object output = type.ParseLiteral(input); // assert Assert.Null(output); }
public void ParseValue_Null() { // arrange var type = new IdType(); object input = null; // act object output = type.ParseValue(input); // assert Assert.IsType<NullValueNode>(output); }
public void Deserialize_Float() { // arrange var type = new IdType(); float serialized = 1.1f; // act bool success = type.TryDeserialize(serialized, out object value); // assert Assert.False(success); }
public void Deserialize_Null() { // arrange var type = new IdType(); object serialized = null; // act bool success = type.TryDeserialize(serialized, out object value); // assert Assert.Null(value); }
public void ParseValue_Int() { // arrange var type = new IdType(); object input = 1234; // act object output = type.ParseValue(input); // assert Assert.IsType <IntValueNode>(output); }
public void Serialize_String() { // arrange var type = new IdType(); var input = "123456"; // act object serializedValue = type.Serialize(input); // assert Assert.IsType <string>(serializedValue); Assert.Equal("123456", serializedValue); }
public void ParseLiteral_IntValueNode() { // arrange var type = new IdType(); var input = new IntValueNode("123456"); // act object output = type.ParseLiteral(input); // assert Assert.IsType <string>(output); Assert.Equal("123456", output); }
public void Deserialize_Int() { // arrange var type = new IdType(); var serialized = 123456; // act bool success = type.TryDeserialize(serialized, out object value); // assert Assert.True(success); Assert.Equal("123456", Assert.IsType<string>(value)); }
public void Deserialize_Int() { // arrange IdType type = SchemaBuilder.New() .AddQueryType(c => c .Name("QueryRoot") .Field("abc") .Type <IdType>() .Resolve("abc")) .Create() .GetType <IdType>("ID"); var serialized = 123456; // act bool success = type.TryDeserialize(serialized, out object value); // assert Assert.True(success); Assert.Equal("123456", Assert.IsType <string>(value)); }