Daniele Teti 2024-04-29 12:46:19 +02:00
parent 8e7e14151d
commit 5bda685228
4 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// ***************************************************************************
// ***************************************************************************
//
// Delphi MVC Framework
//
@ -316,11 +316,15 @@ type
FId: Int64;
FNames: TArray<String>;
FValues: TArray<Integer>;
FValues8: TArray<Byte>;
FValues64: TArray<Int64>;
FBooleans: TArray<Boolean>;
public
property Id: Int64 read FId write FId;
property Names: TArray<String> read FNames write FNames;
property Values: TArray<Integer> read FValues write FValues;
property Values8: TArray<Byte> read FValues8 write FValues8;
property Values64: TArray<Int64> read FValues64 write FValues64;
property Booleans: TArray<Boolean> read FBooleans write FBooleans;
end;

View File

@ -1236,6 +1236,8 @@ begin
try
lObj1.Names := ['one', 'two', 'three'];
lObj1.Values := [1, 2, 3];
lObj1.Values8 := [4, 5, 6];
lObj1.Values64 := [7, 8, 9];
lObj1.Booleans := [true, false];
lBody := GetDefaultSerializer.SerializeObject(lObj1);

View File

@ -1397,7 +1397,7 @@ end;
procedure TMVCTestSerializerJsonDataObjects.TestSerializeEntityWithArray;
const
JSON_WITH_ARRAY = '{' + '"Id":1,' + '"Names":["Pedro","Oliveira"],' +
'"Values":[1,2],"Booleans":[true,false,true]' + '}';
'"Values":[1,2],"Values8":[7,8],"Values64":[3,4],"Booleans":[true,false,true]' + '}';
var
O: TEntityWithArray;
S: string;
@ -1407,6 +1407,8 @@ begin
O.Id := 1;
O.Names := ['Pedro', 'Oliveira'];
O.Values := [1, 2];
O.Values8 := [7, 8];
O.Values64 := [3, 4];
O.Booleans := [True, False, True];
S := fSerializer.SerializeObject(O);
Assert.areEqual(JSON_WITH_ARRAY, S);

View File

@ -913,6 +913,8 @@ begin
try
lObj.Names := lObj.Names + ['added'];
lObj.Values := lObj.Values + [99];
lObj.Values8 := lObj.Values8 + [99];
lObj.Values64 := lObj.Values64 + [99];
lObj.Booleans := lObj.Booleans + [true];
Render(lObj, False);
finally