diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_typed_Direction.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_typed_Direction.verified.txt new file mode 100644 index 000000000..ec11dad0a --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_typed_Direction.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: Direction, + Value: { + EnumName: Direction, + EnumValue: OUT + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_typed_Merge.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_typed_Merge.verified.txt new file mode 100644 index 000000000..bf3b7f374 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_typed_Merge.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: Merge, + Value: { + EnumName: Merge, + EnumValue: onCreate + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_typed_T.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_typed_T.verified.txt new file mode 100644 index 000000000..54ddb138a --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_typed_T.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: T, + Value: { + EnumName: T, + EnumValue: id + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_unknown_typed_T.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_unknown_typed_T.verified.txt new file mode 100644 index 000000000..305d7eb5a --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.EnumWrapper_from_unknown_typed_T.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: T, + Value: { + EnumName: T, + EnumValue: unknown + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_array_from_typed_and_bare_scalars.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_array_from_typed_and_bare_scalars.verified.txt new file mode 100644 index 000000000..52a8ccc85 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_array_from_typed_and_bare_scalars.verified.txt @@ -0,0 +1,20 @@ +{ + ItemTypes: [ + int, + long, + Guid, + string, + double, + bool, + string + ], + Value: [ + 1, + 2, + Guid_1, + id, + 2.5, + true, + abc + ] +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_bool.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_bool.verified.txt new file mode 100644 index 000000000..a2992a8d1 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_bool.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: bool, + Value: true +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_int.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_int.verified.txt new file mode 100644 index 000000000..63cfb4945 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_int.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: long, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_string.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_string.verified.txt new file mode 100644 index 000000000..3b9df41e9 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_string.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: string, + Value: abc +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_BigDecimal.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_BigDecimal.verified.txt new file mode 100644 index 000000000..4e398ad3e --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_BigDecimal.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: decimal, + Value: 1.5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Byte.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Byte.verified.txt new file mode 100644 index 000000000..927894140 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Byte.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: byte, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Char.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Char.verified.txt new file mode 100644 index 000000000..6e197c3ec --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Char.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: char, + Value: x +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Int32.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Int32.verified.txt new file mode 100644 index 000000000..2a2477199 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Int32.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: int, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Int32_with_string_value.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Int32_with_string_value.verified.txt new file mode 100644 index 000000000..3b9df41e9 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_Int32_with_string_value.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: string, + Value: abc +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_T.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_T.verified.txt new file mode 100644 index 000000000..962b5c14a --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_T.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: string, + Value: id +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_UUID.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_UUID.verified.txt new file mode 100644 index 000000000..5234baa1e --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IComparable_from_typed_UUID.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: Guid, + Value: Guid_1 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_double.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_double.verified.txt new file mode 100644 index 000000000..a3083b122 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_double.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: double, + Value: 5.5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_string.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_string.verified.txt new file mode 100644 index 000000000..3b9df41e9 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_string.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: string, + Value: abc +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_Date.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_Date.verified.txt new file mode 100644 index 000000000..2c9ecb026 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_Date.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: long, + Value: 1657527969000 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_Double.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_Double.verified.txt new file mode 100644 index 000000000..9949bf955 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_Double.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: double, + Value: 5.0 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_Int16.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_Int16.verified.txt new file mode 100644 index 000000000..2226e83be --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_Int16.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: short, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_UUID.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_UUID.verified.txt new file mode 100644 index 000000000..f39622023 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IConvertible_from_typed_UUID.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: string, + Value: Guid_1 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_EnumWrapper_from_typed_T.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_EnumWrapper_from_typed_T.verified.txt new file mode 100644 index 000000000..54ddb138a --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_EnumWrapper_from_typed_T.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: T, + Value: { + EnumName: T, + EnumValue: id + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_float_from_typed_Float.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_float_from_typed_Float.verified.txt new file mode 100644 index 000000000..6e34d7aec --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_float_from_typed_Float.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: float, + Value: 1.5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_int_from_int.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_int_from_int.verified.txt new file mode 100644 index 000000000..3d402d914 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_int_from_int.verified.txt @@ -0,0 +1,3 @@ +{ + Success: false +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_int_from_typed_Int32.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_int_from_typed_Int32.verified.txt new file mode 100644 index 000000000..2a2477199 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_int_from_typed_Int32.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: int, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_int_from_typed_Int64.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_int_from_typed_Int64.verified.txt new file mode 100644 index 000000000..3d402d914 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_int_from_typed_Int64.verified.txt @@ -0,0 +1,3 @@ +{ + Success: false +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_long_from_int.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_long_from_int.verified.txt new file mode 100644 index 000000000..63cfb4945 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_long_from_int.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: long, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_string_from_string.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_string_from_string.verified.txt new file mode 100644 index 000000000..3b9df41e9 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IEquatable_of_string_from_string.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: string, + Value: abc +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_int.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_int.verified.txt new file mode 100644 index 000000000..63cfb4945 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_int.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: long, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_typed_BigInteger.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_typed_BigInteger.verified.txt new file mode 100644 index 000000000..d21641754 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_typed_BigInteger.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: BigInteger, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_typed_Float.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_typed_Float.verified.txt new file mode 100644 index 000000000..6e34d7aec --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_typed_Float.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: float, + Value: 1.5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_typed_Timestamp.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_typed_Timestamp.verified.txt new file mode 100644 index 000000000..41af012f6 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IFormattable_from_typed_Timestamp.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: DateTimeOffset, + Value: 2022-07-11 08:26:09 +0 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedCollection_from_Map_of_string_keys.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedCollection_from_Map_of_string_keys.verified.txt new file mode 100644 index 000000000..e63b92641 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedCollection_from_Map_of_string_keys.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: Dictionary, + Value: { + key1: 1, + key2: 2 + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedCollection_from_array.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedCollection_from_array.verified.txt new file mode 100644 index 000000000..47baf1a4c --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedCollection_from_array.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: object[], + Value: [ + 1, + abc + ] +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedCollection_from_object.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedCollection_from_object.verified.txt new file mode 100644 index 000000000..e63b92641 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedCollection_from_object.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: Dictionary, + Value: { + key1: 1, + key2: 2 + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedDictionary_from_Map_of_string_keys.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedDictionary_from_Map_of_string_keys.verified.txt new file mode 100644 index 000000000..e63b92641 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedDictionary_from_Map_of_string_keys.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: Dictionary, + Value: { + key1: 1, + key2: 2 + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedDictionary_from_object.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedDictionary_from_object.verified.txt new file mode 100644 index 000000000..e63b92641 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedDictionary_from_object.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: Dictionary, + Value: { + key1: 1, + key2: 2 + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedList_from_array.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedList_from_array.verified.txt new file mode 100644 index 000000000..47baf1a4c --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.IUntypedList_from_array.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: object[], + Value: [ + 1, + abc + ] +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_Bulk_set_is_an_array.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_Bulk_set_is_an_array.verified.txt new file mode 100644 index 000000000..b66b29eae --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_Bulk_set_is_an_array.verified.txt @@ -0,0 +1,12 @@ +{ + Success: true, + Type: object[], + Value: [ + 10, + 20, + 20, + 30, + 30, + 30 + ] +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_Map_of_string_keys.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_Map_of_string_keys.verified.txt new file mode 100644 index 000000000..e63b92641 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_Map_of_string_keys.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: Dictionary, + Value: { + key1: 1, + key2: 2 + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_array.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_array.verified.txt new file mode 100644 index 000000000..47baf1a4c --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_array.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: object[], + Value: [ + 1, + abc + ] +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_object.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_object.verified.txt new file mode 100644 index 000000000..e63b92641 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_object.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: Dictionary, + Value: { + key1: 1, + key2: 2 + } +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_typed_List.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_typed_List.verified.txt new file mode 100644 index 000000000..47baf1a4c --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_typed_List.verified.txt @@ -0,0 +1,8 @@ +{ + Success: true, + Type: object[], + Value: [ + 1, + abc + ] +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_typed_Tree.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_typed_Tree.verified.txt new file mode 100644 index 000000000..c77f3f351 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.Untyped_IEnumerable_from_typed_Tree.verified.txt @@ -0,0 +1,9 @@ +{ + Success: true, + Type: Tree, + Value: [ + { + Key: 3 + } + ] +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_bool.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_bool.verified.txt new file mode 100644 index 000000000..45480363c --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_bool.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: bool, + Value: false +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_double.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_double.verified.txt new file mode 100644 index 000000000..a3083b122 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_double.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: double, + Value: 5.5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_int.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_int.verified.txt new file mode 100644 index 000000000..63cfb4945 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_int.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: long, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_Date.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_Date.verified.txt new file mode 100644 index 000000000..41af012f6 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_Date.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: DateTimeOffset, + Value: 2022-07-11 08:26:09 +0 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_Duration.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_Duration.verified.txt new file mode 100644 index 000000000..395294115 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_Duration.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: TimeSpan, + Value: 01:00:00 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_Int32.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_Int32.verified.txt new file mode 100644 index 000000000..2a2477199 --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_Int32.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: int, + Value: 5 +} \ No newline at end of file diff --git a/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_UUID.verified.txt b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_UUID.verified.txt new file mode 100644 index 000000000..5234baa1e --- /dev/null +++ b/test/Support.NewtonsoftJson.Tests/GraphsonSupportTest.ValueType_from_typed_UUID.verified.txt @@ -0,0 +1,5 @@ +{ + Success: true, + Type: Guid, + Value: Guid_1 +} \ No newline at end of file diff --git a/test/Tests.Infrastructure/GraphSon/GraphsonSupportTestBase.cs b/test/Tests.Infrastructure/GraphSon/GraphsonSupportTestBase.cs index 4bbb0f428..9455ef0f4 100644 --- a/test/Tests.Infrastructure/GraphSon/GraphsonSupportTestBase.cs +++ b/test/Tests.Infrastructure/GraphSon/GraphsonSupportTestBase.cs @@ -829,6 +829,239 @@ public virtual Task Property_from_typed_Property() => Verify>(""" [Fact] public virtual Task DateTime_from_typed_Timestamp() => Verify("""{ "@type": "g:Timestamp", "@value": 1657527969000 }"""); + // The tests below ask for a base type or an interface, which more than one type could + // stand in for - an IComparable is given an int, a long or a string alike, and a snapshot + // of 5 does not say which. There the type is the answer, so it is recorded alongside the + // value, the way Map_of_typed_int_keys_as_object does it. + protected SettingsTask VerifyAttemptWithRuntimeType(string token) + { + object outcome; + + try + { + outcome = _environment + .Deserializer + .TryTransform(CreateNativeToken(token), _environment, out var value) + ? new { Success = true, Type = (Type?)value.GetType(), Value = (object?)value } + : new { Success = false, Type = (Type?)null, Value = (object?)null }; + } + catch (Exception ex) + { + outcome = new { Success = false, Threw = ex.GetType().Name }; + } + + return Verifier + .Verify(outcome, sourceFile: _sourceFile) + .DontScrubDateTimes(); + } + + // A typed value is the type its name stands for to everything that could hold that type, + // not only to an object: a g:Int32 is an int to an IComparable and to a ValueType, a + // g:Float a float, a g:UUID a Guid. Its bare @value, read without the name, would be a + // long, a double and a string. + [Fact] + public virtual Task IComparable_from_typed_Int32() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Int32", "@value": 5 }"""); + + [Fact] + public virtual Task ValueType_from_typed_Int32() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Int32", "@value": 5 }"""); + + [Fact] + public virtual Task IEquatable_of_int_from_typed_Int32() => VerifyAttemptWithRuntimeType>("""{ "@type": "g:Int32", "@value": 5 }"""); + + [Fact] + public virtual Task IFormattable_from_typed_Float() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Float", "@value": 1.5 }"""); + + [Fact] + public virtual Task IEquatable_of_float_from_typed_Float() => VerifyAttemptWithRuntimeType>("""{ "@type": "g:Float", "@value": 1.5 }"""); + + [Fact] + public virtual Task IConvertible_from_typed_Double() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Double", "@value": 5 }"""); + + [Fact] + public virtual Task IComparable_from_typed_UUID() => VerifyAttemptWithRuntimeType("""{ "@type": "g:UUID", "@value": "41d2e28a-20a4-4ab0-b379-d810dede3786" }"""); + + [Fact] + public virtual Task ValueType_from_typed_UUID() => VerifyAttemptWithRuntimeType("""{ "@type": "g:UUID", "@value": "41d2e28a-20a4-4ab0-b379-d810dede3786" }"""); + + [Fact] + public virtual Task ValueType_from_typed_Date() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Date", "@value": 1657527969000 }"""); + + [Fact] + public virtual Task IFormattable_from_typed_Timestamp() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Timestamp", "@value": 1657527969000 }"""); + + [Fact] + public virtual Task IComparable_from_typed_BigDecimal() => VerifyAttemptWithRuntimeType("""{ "@type": "gx:BigDecimal", "@value": 1.5 }"""); + + [Fact] + public virtual Task ValueType_from_typed_Duration() => VerifyAttemptWithRuntimeType("""{ "@type": "gx:Duration", "@value": "PT1H" }"""); + + [Fact] + public virtual Task IFormattable_from_typed_BigInteger() => VerifyAttemptWithRuntimeType("""{ "@type": "gx:BigInteger", "@value": 5 }"""); + + [Fact] + public virtual Task IComparable_from_typed_Byte() => VerifyAttemptWithRuntimeType("""{ "@type": "gx:Byte", "@value": 5 }"""); + + [Fact] + public virtual Task IConvertible_from_typed_Int16() => VerifyAttemptWithRuntimeType("""{ "@type": "gx:Int16", "@value": 5 }"""); + + [Fact] + public virtual Task IComparable_from_typed_Char() => VerifyAttemptWithRuntimeType("""{ "@type": "gx:Char", "@value": "x" }"""); + + // The same for Gremlin's enumerations, whose base type is Gremlin.Net's EnumWrapper: a g:T + // is a T to it, a value Gremlin.Net has no name for included. + [Fact] + public virtual Task EnumWrapper_from_typed_T() => VerifyAttemptWithRuntimeType("""{ "@type": "g:T", "@value": "id" }"""); + + [Fact] + public virtual Task EnumWrapper_from_unknown_typed_T() => VerifyAttemptWithRuntimeType("""{ "@type": "g:T", "@value": "unknown" }"""); + + [Fact] + public virtual Task EnumWrapper_from_typed_Direction() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Direction", "@value": "OUT" }"""); + + [Fact] + public virtual Task EnumWrapper_from_typed_Merge() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Merge", "@value": "onCreate" }"""); + + [Fact] + public virtual Task IEquatable_of_EnumWrapper_from_typed_T() => VerifyAttemptWithRuntimeType>("""{ "@type": "g:T", "@value": "id" }"""); + + // And for a g:Tree, which the non-generic IEnumerable can hold as the tree it is, rather + // than as the array its @value is. + [Fact] + public virtual Task Untyped_IEnumerable_from_typed_Tree() => VerifyAttemptWithRuntimeType(GraphSonStrings.RootOnly_string_tree); + + // Where the requested type cannot hold the type the name stands for - a Guid is no + // IConvertible, a DateTimeOffset neither, and a T is no IComparable - the bare @value is + // all there is to go by, and it is read as it would be without the name around it. + [Fact] + public virtual Task IConvertible_from_typed_UUID() => VerifyAttemptWithRuntimeType("""{ "@type": "g:UUID", "@value": "41d2e28a-20a4-4ab0-b379-d810dede3786" }"""); + + [Fact] + public virtual Task IConvertible_from_typed_Date() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Date", "@value": 1657527969000 }"""); + + [Fact] + public virtual Task IComparable_from_typed_T() => VerifyAttemptWithRuntimeType("""{ "@type": "g:T", "@value": "id" }"""); + + // So it is where the @value does not fit the type the name stands for. That is no error: + // "abc" is no int, but it is a string, and an IComparable can hold one. + [Fact] + public virtual Task IComparable_from_typed_Int32_with_string_value() => VerifyAttemptWithRuntimeType("""{ "@type": "g:Int32", "@value": "abc" }"""); + + // And where neither can be held, there is nothing to answer with: a g:Int64 is a long, + // its bare @value is one too, and a long is no IEquatable. + [Fact] + public virtual Task IEquatable_of_int_from_typed_Int64() => VerifyAttemptWithRuntimeType>("""{ "@type": "g:Int64", "@value": 5 }"""); + + // A bare scalar is to everything that could hold it what it is to an object: a string a + // string, a number a long or a double, true and false a bool. + [Fact] + public virtual Task IComparable_from_string() => VerifyAttemptWithRuntimeType("\"abc\""); + + [Fact] + public virtual Task IConvertible_from_string() => VerifyAttemptWithRuntimeType("\"abc\""); + + [Fact] + public virtual Task IEquatable_of_string_from_string() => VerifyAttemptWithRuntimeType>("\"abc\""); + + [Fact] + public virtual Task IComparable_from_int() => VerifyAttemptWithRuntimeType("5"); + + [Fact] + public virtual Task IFormattable_from_int() => VerifyAttemptWithRuntimeType("5"); + + [Fact] + public virtual Task ValueType_from_int() => VerifyAttemptWithRuntimeType("5"); + + [Fact] + public virtual Task IEquatable_of_long_from_int() => VerifyAttemptWithRuntimeType>("5"); + + [Fact] + public virtual Task IConvertible_from_double() => VerifyAttemptWithRuntimeType("5.5"); + + [Fact] + public virtual Task ValueType_from_double() => VerifyAttemptWithRuntimeType("5.5"); + + [Fact] + public virtual Task IComparable_from_bool() => VerifyAttemptWithRuntimeType("true"); + + [Fact] + public virtual Task ValueType_from_bool() => VerifyAttemptWithRuntimeType("false"); + + // What the requested type cannot hold is no answer. A bare 5 is a long, as it is to an + // object, and no IEquatable for being small enough to be an int. + [Fact] + public virtual Task IEquatable_of_int_from_int() => VerifyAttemptWithRuntimeType>("5"); + + // All of the above holds for the items of an array as it does for a value on its own. + [Fact] + public virtual Task IComparable_array_from_typed_and_bare_scalars() + { + var subject = _environment + .Deserializer + .TransformTo() + .From( + CreateNativeToken(""" + [ + { "@type": "g:Int32", "@value": 1 }, + { "@type": "g:Int64", "@value": 2 }, + { "@type": "g:UUID", "@value": "41d2e28a-20a4-4ab0-b379-d810dede3786" }, + { "@type": "g:T", "@value": "id" }, + 2.5, + true, + "abc" + ] + """), + _environment); + + return Verifier + .Verify( + new + { + ItemTypes = subject.Select(static item => item.GetType()).ToArray(), + Value = subject + }, + sourceFile: _sourceFile) + .DontScrubDateTimes(); + } + + // An array is an object[] to each of the non-generic collection interfaces, all of which + // an object[] implements - to IEnumerable no less than to ICollection and IList. So is + // a g:List, and a bulk set. + [Fact] + public virtual Task Untyped_IEnumerable_from_array() => VerifyAttemptWithRuntimeType("""[ { "@type": "g:Int32", "@value": 1 }, "abc" ]"""); + + [Fact] + public virtual Task IUntypedCollection_from_array() => VerifyAttemptWithRuntimeType("""[ { "@type": "g:Int32", "@value": 1 }, "abc" ]"""); + + [Fact] + public virtual Task IUntypedList_from_array() => VerifyAttemptWithRuntimeType("""[ { "@type": "g:Int32", "@value": 1 }, "abc" ]"""); + + [Fact] + public virtual Task Untyped_IEnumerable_from_typed_List() => VerifyAttemptWithRuntimeType("""{ "@type": "g:List", "@value": [ { "@type": "g:Int32", "@value": 1 }, "abc" ] }"""); + + [Fact] + public virtual Task Untyped_IEnumerable_from_Bulk_set_is_an_array() => VerifyAttemptWithRuntimeType(Typed_BulkSet); + + // An object is a Dictionary to the non-generic IDictionary, and to an + // ICollection or an IEnumerable, which a dictionary is as well. So is a map whose keys are + // all strings, which is read the way an object is. + [Fact] + public virtual Task IUntypedDictionary_from_object() => VerifyAttemptWithRuntimeType(String_Keys_Typed_Int_Values); + + [Fact] + public virtual Task IUntypedCollection_from_object() => VerifyAttemptWithRuntimeType(String_Keys_Typed_Int_Values); + + [Fact] + public virtual Task Untyped_IEnumerable_from_object() => VerifyAttemptWithRuntimeType(String_Keys_Typed_Int_Values); + + [Fact] + public virtual Task IUntypedDictionary_from_Map_of_string_keys() => VerifyAttemptWithRuntimeType(Map_of_String_Keys_Typed_Int_Values); + + [Fact] + public virtual Task IUntypedCollection_from_Map_of_string_keys() => VerifyAttemptWithRuntimeType(Map_of_String_Keys_Typed_Int_Values); + + [Fact] + public virtual Task Untyped_IEnumerable_from_Map_of_string_keys() => VerifyAttemptWithRuntimeType(Map_of_String_Keys_Typed_Int_Values); + [Fact] public virtual Task Object_from_typed_Direction() => Verify("""{ "@type": "g:Direction", "@value": "OUT" }""");