public void ParseValue_Int() { // arrange var uuidType = new UuidType(); int value = 123; // act Action action = () => uuidType.ParseValue(value); // assert Assert.Throws <ScalarSerializationException>(action); }
public void ParseValue_With_Format(char format) { // arrange var uuidType = new UuidType(defaultFormat: format); Guid guid = Guid.Empty; // act var s = (StringValueNode)uuidType.ParseValue(guid); // assert Assert.Equal(guid.ToString(format.ToString()), s.Value); }
public void ParseValue_Int() { // arrange var uuidType = new UuidType(); var value = 123; // act void Action() => uuidType.ParseValue(value); // assert Assert.Throws <SerializationException>(Action); }
public void ParseValue_Null() { // arrange var uuidType = new UuidType(); Guid?guid = null; // act IValueNode stringLiteral = uuidType.ParseValue(guid); // assert Assert.True(stringLiteral is NullValueNode); Assert.Null(((NullValueNode)stringLiteral).Value); }
public void ParseValue_Guid() { // arrange var uuidType = new UuidType(); var expected = Guid.NewGuid(); var expectedLiteralValue = expected.ToString("N"); // act var stringLiteral = (StringValueNode)uuidType.ParseValue(expected); // assert Assert.Equal(expectedLiteralValue, stringLiteral.Value); }