Пример #1
0
	public void Value_Creates_With_Json(object input, string expected)
	{
		// Arrange

		// Act
		var result = Jsonb.Create(input);

		// Assert
		Assert.Equal(expected, result.ToString());
	}
Пример #2
0
	public void Null_Object_Creates_With_Empty_Json()
	{
		// Arrange
		int? value = null;

		// Act
		var result = Jsonb.Create(value);

		// Assert
		Assert.Equal(JsonF.Empty, result.ToString());
	}
Пример #3
0
	public void Object_Creates_With_Json()
	{
		// Arrange
		var value = new Test(Rnd.Str, Rnd.Int);
		var json = JsonF.Serialise(value).UnsafeUnwrap();

		// Act
		var result = Jsonb.Create(value);

		// Assert
		Assert.Equal(json, result.ToString());
	}
Пример #4
0
        object IUserType.NullSafeGet(DbDataReader rs, string[] names, ISessionImplementor session, object owner)
        {
            if (names.Length != 1)
            {
                throw new InvalidOperationException("Only expecting one column...");
            }


            object value = rs[names[0]];

            if (value == DBNull.Value)
            {
                return(Jsonb.Null);
            }
            else
            {
                return(Jsonb.Create((string)value));
            }
        }