public void ParseValue_Wrong_Value_Throws() { // arrange var type = new ShortType(); var value = "123"; // act // assert Assert.Throws <ScalarSerializationException>( () => type.ParseValue(value)); }
public void ParseValue_Nullable() { // arrange var type = new ShortType(); short?input = 123; // act IntValueNode output = (IntValueNode)type.ParseValue(input); // assert Assert.Equal(123, output.ToDouble()); }
public void ParseValue_Null() { // arrange var type = new ShortType(); object input = null; // act object output = type.ParseValue(input); // assert Assert.IsType <NullValueNode>(output); }
public void ParseValue_MinValue_Violation() { // arrange var type = new ShortType(1, 100); short input = 0; // act Action action = () => type.ParseValue(input); // assert Assert.Throws <ScalarSerializationException>(action); }
public void ParseValue_MinValue() { // arrange var type = new ShortType(1, 100); short input = 1; // act var literal = (IntValueNode)type.ParseValue(input); // assert Assert.Equal(1, literal.ToByte()); }