diff --git a/tests/CSharpDataModels/DataModels.cs b/tests/CSharpDataModels/DataModels.cs index 5cf93dd..fe7f642 100644 --- a/tests/CSharpDataModels/DataModels.cs +++ b/tests/CSharpDataModels/DataModels.cs @@ -18,25 +18,25 @@ public record PairValue(Pair Value) : Value; public record RecordDataModel { - // public ObjectId Id { get; init; } - // - // public required int Int { get; init; } - // public int? IntOpt { get; init; } - // - // public required string String { get; init; } - // public string? StringOpt { get; init; } - // - // public required int[] Array { get; init; } - // public int[]? ArrayOpt { get; init; } - - // public required Value Value { get; init; } - // public Value? ValueOpt { get; init; } - - // public required Value[] ValueArray { get; init; } - // public Value[]? ValueArrayOpt { get; init; } - - // public required Pair Record { get; init; } + public ObjectId Id { get; init; } + + public required int Int { get; init; } + public int? IntOpt { get; init; } + + public required string String { get; init; } + public string? StringOpt { get; init; } + + public required int[] Array { get; init; } + public int[]? ArrayOpt { get; init; } + + public required Value Value { get; init; } + public Value? ValueOpt { get; init; } + + public required Value[] ValueArray { get; init; } + public Value[]? ValueArrayOpt { get; init; } + + public required Pair Record { get; init; } public Pair? RecordOpt { get; init; } - // public required Dictionary Map { get; init; } + public required Dictionary Map { get; init; } } diff --git a/tests/FSharp.MongoDB.Bson.Tests/Isomorphic/IsomorphicTests.fs b/tests/FSharp.MongoDB.Bson.Tests/Isomorphic/IsomorphicTests.fs index 3fd0d0e..8b0f0a8 100644 --- a/tests/FSharp.MongoDB.Bson.Tests/Isomorphic/IsomorphicTests.fs +++ b/tests/FSharp.MongoDB.Bson.Tests/Isomorphic/IsomorphicTests.fs @@ -19,29 +19,27 @@ module IsomorphicSerialization = [] type RecordDataModel = - { - // Id: ObjectId + { Id: ObjectId - // Int: int - // IntOpt: int option - // - // String: string - // StringOpt: string option - // - // Array: int array - // ArrayOpt: int array option - // - // Value: Value - // ValueOpt: Value option + Int: int + IntOpt: int option - // ValueArray: Value array - // ValueArrayOpt: Value array option + String: string + StringOpt: string option - // Record: Pair + Array: int array + ArrayOpt: int array option + + Value: Value + ValueOpt: Value option + + ValueArray: Value array + ValueArrayOpt: Value array option + + Record: Pair RecordOpt: Pair option - // Map: Map - } + Map: Map } let ModelSome() = let csModel = @@ -51,42 +49,39 @@ module IsomorphicSerialization = map.Add("2", 2) map - RecordDataModel( - // Id = ObjectId.GenerateNewId(), - // Int = 42, - // IntOpt = 666, - // String = "String", - // StringOpt = "StringOpt", - // Array = [| 1; 2; 3 |], - // ArrayOpt = [| 5; 6; 7; 8 |], - // Value = CSharpDataModels.Value.IntValue(42), - // ValueOpt = CSharpDataModels.Value.StringValue("ValueStringOpt"), - // ValueArray = [| CSharpDataModels.Value.IntValue(42) - // CSharpDataModels.Value.StringValue("String") - // CSharpDataModels.Value.PairValue(CSharpDataModels.Pair(First = 99, Second = "SecondPair")) |], - // ValueArrayOpt = [| CSharpDataModels.Value.IntValue(101) |], - // Record = CSharpDataModels.Pair(First = 1, Second = "Second"), - RecordOpt = CSharpDataModels.Pair(First = -1, Second = "SecondOpt") - // Map = map - ) + CSharpDataModels.RecordDataModel( + Id = ObjectId.GenerateNewId(), + Int = 42, + IntOpt = 666, + String = "String", + StringOpt = "StringOpt", + Array = [| 1; 2; 3 |], + ArrayOpt = [| 5; 6; 7; 8 |], + Value = CSharpDataModels.Value.IntValue(42), + ValueOpt = CSharpDataModels.Value.StringValue("ValueStringOpt"), + ValueArray = [| CSharpDataModels.Value.IntValue(42) + CSharpDataModels.Value.StringValue("String") + CSharpDataModels.Value.PairValue(CSharpDataModels.Pair(First = 99, Second = "SecondPair")) |], + ValueArrayOpt = [| CSharpDataModels.Value.IntValue(101) |], + Record = CSharpDataModels.Pair(First = 1, Second = "Second"), + RecordOpt = CSharpDataModels.Pair(First = -1, Second = "SecondOpt"), + Map = map) let fsModel = - { - // Id = csModel.Id - // Int = 42 - // IntOpt = Some 666 - // String = "String" - // StringOpt = Some "StringOpt" - // Array = [| 1; 2; 3 |] - // ArrayOpt = Some [| 5; 6; 7; 8 |] - // Value = Value.IntValue 42 - // ValueOpt = Some <| Value.StringValue "ValueStringOpt" - // ValueArray = [| Value.IntValue 42; Value.StringValue "String"; Value.PairValue { First = 99; Second = Some "SecondPair" } |] - // ValueArrayOpt = Some [| Value.IntValue 101 |] - // Record = { First = 1; Second = Some "Second" } + { Id = csModel.Id + Int = 42 + IntOpt = Some 666 + String = "String" + StringOpt = Some "StringOpt" + Array = [| 1; 2; 3 |] + ArrayOpt = Some [| 5; 6; 7; 8 |] + Value = Value.IntValue 42 + ValueOpt = Some <| Value.StringValue "ValueStringOpt" + ValueArray = [| Value.IntValue 42; Value.StringValue "String"; Value.PairValue { First = 99; Second = Some "SecondPair" } |] + ValueArrayOpt = Some [| Value.IntValue 101 |] + Record = { First = 1; Second = Some "Second" } RecordOpt = Some { First = -1; Second = Some "SecondOpt" } - // Map = Map [ "1", 1; "2", 2 ] - } + Map = Map [ "1", 1; "2", 2 ] } csModel, fsModel @@ -98,36 +93,33 @@ module IsomorphicSerialization = map.Add("2", 2) map - RecordDataModel( - // Id = ObjectId.GenerateNewId(), - // Int = 42, - // String = "String", - // Array = [| 1; 2; 3 |], - // Value = CSharpDataModels.Value.IntValue(42), - // ValueArray = [| CSharpDataModels.Value.IntValue(42) - // CSharpDataModels.Value.StringValue("String") - // CSharpDataModels.Value.PairValue(CSharpDataModels.Pair(First = 99, Second = "SecondPair")) |], - // Record = CSharpDataModels.Pair(First = 1, Second = "Second"), - // Map = map - ) + CSharpDataModels.RecordDataModel( + Id = ObjectId.GenerateNewId(), + Int = 42, + String = "String", + Array = [| 1; 2; 3 |], + Value = CSharpDataModels.Value.IntValue(42), + ValueArray = [| CSharpDataModels.Value.IntValue(42) + CSharpDataModels.Value.StringValue("String") + CSharpDataModels.Value.PairValue(CSharpDataModels.Pair(First = 99, Second = "SecondPair")) |], + Record = CSharpDataModels.Pair(First = 1, Second = "Second"), + Map = map) let fsModel = - { - // Id = csModel.Id - // Int = 42 - // IntOpt = None - // String = "String" - // StringOpt = None - // Array = [| 1; 2; 3 |] - // ArrayOpt = None - // Value = Value.IntValue 42 - // ValueOpt = None - // ValueArray = [| Value.IntValue 42; Value.StringValue "String"; Value.PairValue { First = 99; Second = Some "SecondPair" } |] - // ValueArrayOpt = None - // Record = { First = 1; Second = Some "Second" } + { Id = csModel.Id + Int = 42 + IntOpt = None + String = "String" + StringOpt = None + Array = [| 1; 2; 3 |] + ArrayOpt = None + Value = Value.IntValue 42 + ValueOpt = None + ValueArray = [| Value.IntValue 42; Value.StringValue "String"; Value.PairValue { First = 99; Second = Some "SecondPair" } |] + ValueArrayOpt = None + Record = { First = 1; Second = Some "Second" } RecordOpt = None - // Map = Map [ "1", 1; "2", 2 ] - } + Map = Map [ "1", 1; "2", 2 ] } csModel, fsModel