public void IsInstanceOfType_Null_Throws() { // arrange var type = new LongType(); // act // assert Assert.Throws <ArgumentNullException>( () => type.IsInstanceOfType(null)); }
public void ParseLiteral_Null_Throws() { // arrange var type = new LongType(); // act // assert Assert.Throws <ArgumentNullException>( () => type.ParseLiteral(null)); }
public void IsInstanceOfType_StringLiteral_False() { // arrange var type = new LongType(); // act var result = type.IsInstanceOfType(new FloatValueNode(1M)); // assert Assert.False(result); }
public void Ensure_TypeKind_is_Scalar() { // arrange var type = new LongType(); // act TypeKind kind = type.Kind; // assert Assert.Equal(TypeKind.Scalar, kind); }
public void Serialize_Wrong_Type_Throws() { // arrange var type = new LongType(); var input = "abc"; // act // assert Assert.Throws <SerializationException>( () => type.Serialize(input)); }
public void IsInstanceOfType_NullLiteral_True() { // arrange var type = new LongType(); // act var result = type.IsInstanceOfType(NullValueNode.Default); // assert Assert.True(result); }
public void ParseValue_Wrong_Value_Throws() { // arrange var type = new LongType(); var value = "123"; // act // assert Assert.Throws <SerializationException>( () => type.ParseValue(value)); }
public void ParseLiteral_Wrong_ValueNode_Throws() { // arrange var type = new LongType(); var input = new StringValueNode("abc"); // act // assert Assert.Throws <SerializationException>( () => type.ParseLiteral(input)); }
public void ParseLiteral_NullValueNode() { // arrange var type = new LongType(); // act var output = type.ParseLiteral(NullValueNode.Default); // assert Assert.Null(output); }
public void Serialize_Null() { // arrange var type = new LongType(); // act var serializedValue = type.Serialize(null); // assert Assert.Null(serializedValue); }
public void Serialize_MaxValue_Violation() { // arrange var type = new LongType(0, 100); long value = 200; // act // assert Assert.Throws <SerializationException>( () => type.Serialize(value)); }
public void ParseValue_Nullable() { // arrange var type = new LongType(); long?input = 123; // act IntValueNode output = (IntValueNode)type.ParseValue(input); // assert Assert.Equal(123, output.ToDouble()); }
public void ParseValue_MinValue_Violation() { // arrange var type = new LongType(1, 100); long input = 0; // act Action action = () => type.ParseValue(input); // assert Assert.Throws <SerializationException>(action); }
public void ParseValue_MinValue() { // arrange var type = new LongType(1, 100); long input = 1; // act var literal = (IntValueNode)type.ParseValue(input); // assert Assert.Equal(1, literal.ToByte()); }
public void IsInstanceOfType_FloatLiteral_True() { // arrange var type = new LongType(); var literal = new IntValueNode(1); // act var result = type.IsInstanceOfType(literal); // assert Assert.True(result); }
public void ParseValue_Null() { // arrange var type = new LongType(); object input = null; // act object output = type.ParseValue(input); // assert Assert.IsType <NullValueNode>(output); }
public void ParseLiteral_IntLiteral() { // arrange var type = new LongType(); var literal = new IntValueNode(1); // act var value = type.ParseLiteral(literal); // assert Assert.IsType <long>(value); Assert.Equal(literal.ToInt64(), value); }
public void Serialize_Type() { // arrange var type = new LongType(); long value = 123; // act var serializedValue = type.Serialize(value); // assert Assert.IsType <long>(serializedValue); Assert.Equal(value, serializedValue); }