public void ConvertToClrTypeWithCulture( CultureInfo culture, object expected, SpannerDbType spannerDbType, string inputJson, TestType testType = TestType.Both) { if (testType == TestType.ClrToValue) { return; } WithCulture(culture, () => { string infoAddendum = $"type:{expected?.GetType().Name}, spannerType:{spannerDbType}, input:{inputJson} "; try { var wireValue = JsonParser.Default.Parse <Value>(inputJson); var targetClrType = expected?.GetType() ?? typeof(object); var actual = spannerDbType.ConvertToClrType(wireValue, targetClrType, SpannerConversionOptions.Default, topLevel: true); Assert.Equal(expected, actual); } catch (Exception e) { Assert.True(false, infoAddendum + e); throw; } }); }
public void TestNullConversion_LegacyNullHandling(object expectedValue, SpannerDbType dbType, System.Type targetClrType) { var builder = new SpannerConnectionStringBuilder("UseClrDefaultForNull = true"); var options = SpannerConversionOptions.ForConnectionStringBuilder(builder); var input = Value.ForNull(); var actual = dbType.ConvertToClrType(input, targetClrType, options, topLevel: true); Assert.Equal(expectedValue, actual); }