mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
JSONRPC // all tests are green (WIP)
This commit is contained in:
parent
321e80e403
commit
10dff93784
@ -345,6 +345,7 @@ type
|
||||
class function Create: TSimpleRecord; overload; static;
|
||||
class function Create(Value: Integer): TSimpleRecord; overload; static;
|
||||
function ToString: String;
|
||||
function Equals(SimpleRecord: TSimpleRecord): Boolean;
|
||||
end;
|
||||
|
||||
TSimpleRecordDynArray = TArray<TSimpleRecord>;
|
||||
@ -365,6 +366,7 @@ type
|
||||
SimpleRecordDynArray: TSimpleRecordDynArray;
|
||||
SimpleRecordStaticArray: TSimpleRecordStaticArray;
|
||||
class function Create: TComplexRecord; static;
|
||||
function Equals(ComplexRecord: TComplexRecord): Boolean;
|
||||
end;
|
||||
|
||||
TComplexRecordArray = TArray<TComplexRecord>;
|
||||
@ -790,6 +792,21 @@ begin
|
||||
Result.CurrencyProperty := Value + Value div 1000;
|
||||
end;
|
||||
|
||||
function TSimpleRecord.Equals(SimpleRecord: TSimpleRecord): Boolean;
|
||||
begin
|
||||
Result := StringProperty = SimpleRecord.StringProperty;
|
||||
Result := IntegerProperty = SimpleRecord.IntegerProperty;
|
||||
Result := FloatProperty = SimpleRecord.FloatProperty;
|
||||
Result := CurrencyProperty = SimpleRecord.CurrencyProperty;
|
||||
Result := DateProperty = SimpleRecord.DateProperty;
|
||||
Result := TimeProperty = SimpleRecord.TimeProperty;
|
||||
Result := CompareValue(DateTimeProperty, SimpleRecord.DateTimeProperty, 0.0001) = 0;
|
||||
Result := BooleanProperty = SimpleRecord.BooleanProperty;
|
||||
Result := EnumProperty = SimpleRecord.EnumProperty;
|
||||
Result := SetProperty * SimpleRecord.SetProperty = [EnumItem1, EnumItem3];
|
||||
Result := SetProperty - SimpleRecord.SetProperty = [];
|
||||
end;
|
||||
|
||||
function TSimpleRecord.ToString: String;
|
||||
function SetToString: String;
|
||||
var
|
||||
@ -838,6 +855,22 @@ begin
|
||||
Result.SimpleRecordStaticArray[2] := TSimpleRecord.Create(5);
|
||||
end;
|
||||
|
||||
function TComplexRecord.Equals(ComplexRecord: TComplexRecord): Boolean;
|
||||
begin
|
||||
Result := StringProperty = ComplexRecord.StringProperty;
|
||||
Result := IntegerProperty = ComplexRecord.IntegerProperty;
|
||||
Result := FloatProperty = ComplexRecord.FloatProperty;
|
||||
Result := CurrencyProperty = ComplexRecord.CurrencyProperty;
|
||||
Result := DateProperty = ComplexRecord.DateProperty;
|
||||
Result := TimeProperty = ComplexRecord.TimeProperty;
|
||||
Result := CompareValue(DateTimeProperty, ComplexRecord.DateTimeProperty, 0.0001) = 0;
|
||||
Result := BooleanProperty = ComplexRecord.BooleanProperty;
|
||||
Result := EnumProperty = ComplexRecord.EnumProperty;
|
||||
Result := SetProperty * ComplexRecord.SetProperty = [EnumItem1, EnumItem3];
|
||||
Result := SetProperty - ComplexRecord.SetProperty = [];
|
||||
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
Randomize;
|
||||
|
@ -68,6 +68,8 @@
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
|
||||
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||
<DCC_UsePackage>DBXSqliteDriver;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;Spring.Data;inetdb;FmxTeeUI;emsedge;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;emshosting;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;ibxbindings;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
@ -84,6 +86,8 @@
|
||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
@ -127,6 +131,12 @@
|
||||
<Source>
|
||||
<Source Name="MainSource">jsonrpcclientwithobjects.dpr</Source>
|
||||
</Source>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
</Delphi.Personality>
|
||||
<Deployment Version="3">
|
||||
<DeployFile LocalName="Win32\Debug\jsonrpcclientwithobjects.exe" Configuration="Debug" Class="ProjectOutput">
|
||||
|
@ -453,7 +453,12 @@ uses
|
||||
|
||||
procedure RaiseSerializationError(const Msg: string);
|
||||
begin
|
||||
raise EMVCSerializationException.Create(Msg);
|
||||
raise EMVCSerializationException.Create(Msg) at ReturnAddress;
|
||||
end;
|
||||
|
||||
procedure RaiseDeSerializationError(const Msg: string);
|
||||
begin
|
||||
raise EMVCDeSerializationException.Create(Msg) at ReturnAddress;
|
||||
end;
|
||||
|
||||
function StrDict: TMVCStringDictionary; overload;
|
||||
@ -1205,7 +1210,7 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
raise EMVCDeserializationException.Create('Cannot deserialize field ' +
|
||||
RaiseDeSerializationError('Cannot deserialize field ' +
|
||||
AField.FieldName);
|
||||
end;
|
||||
end;
|
||||
|
@ -54,9 +54,6 @@ type
|
||||
|
||||
procedure DeserializeRoot(const ASerializerObject: TObject; const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
TMVCStringDictionarySerializer = class(TInterfacedObject, IMVCTypeSerializer)
|
||||
@ -98,8 +95,6 @@ type
|
||||
const ASerializerObject: TObject; const AAttributes: TArray<TCustomAttribute>);
|
||||
procedure DeserializeRoot(const ASerializerObject: TObject; const AObject: TObject;
|
||||
const AAttributes: TArray<TCustomAttribute>);
|
||||
// internal use
|
||||
// class procedure Serialize(const ADict: TMVCStringDictionary; const AJSONObject: TJsonObject); inline;
|
||||
end;
|
||||
|
||||
TMVCListOfStringSerializer = class(TInterfacedObject, IMVCTypeSerializer)
|
||||
|
@ -81,12 +81,6 @@ type
|
||||
const AIgnored: TMVCIgnoredList;
|
||||
var AValue: TValue; const ACustomAttributes: TArray<TCustomAttribute>;
|
||||
const ARTTIField: TRTTIField);
|
||||
procedure JSONObjectToTValueForRecord(AJSONObject: TJSONObject;
|
||||
const AType: TMVCSerializationType;
|
||||
const AIgnored: TMVCIgnoredList;
|
||||
var ABuffer: PByte;
|
||||
var AValue: TValue;
|
||||
const ACustomAttributes: TArray<TCustomAttribute>);
|
||||
function GetDataSetFields(const ADataSet: TDataSet; const AIgnoredFields: TMVCIgnoredList;
|
||||
const ANameCase: TMVCNameCase = ncAsIs): TMVCDataSetFields;
|
||||
procedure ObjectToJsonObject(const AObject: TObject; const AJsonObject: TJDOJsonObject;
|
||||
@ -485,11 +479,16 @@ begin
|
||||
begin
|
||||
CastValue := AValue.AsType<TValue>;
|
||||
if CastValue.TryCast(ValueTypeAtt.ValueTypeInfo, CastedValue) then
|
||||
begin
|
||||
TValueToJSONObjectProperty(AJsonObject, AName, CastedValue, stDefault, [], [])
|
||||
end
|
||||
else
|
||||
raise EMVCSerializationException.CreateFmt
|
||||
('Cannot serialize property or field "%s" of TypeKind tkRecord (TValue with MVCValueAsTypeAttribute).',
|
||||
[AName]);
|
||||
begin
|
||||
RaiseSerializationError(
|
||||
Format(
|
||||
'Cannot serialize property or field "%s" of TypeKind tkRecord (TValue with MVCValueAsTypeAttribute)',
|
||||
[AName]));
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -1743,13 +1742,6 @@ var
|
||||
TSetOfType = set of TSetOfTypeElement;
|
||||
var
|
||||
I: Integer;
|
||||
lStrArr: TArray<string>;
|
||||
lIntArr: TArray<Integer>;
|
||||
lLongArr: TArray<Int64>;
|
||||
lDoubleArr: TArray<Double>;
|
||||
lBoolArr: TArray<Boolean>;
|
||||
lSetOfType: TSetOfType;
|
||||
lEl: TSetOfTypeElement;
|
||||
lJArr: TJsonArray;
|
||||
lArrayItemType: TJsonDataType;
|
||||
begin
|
||||
@ -2046,6 +2038,7 @@ begin
|
||||
[AValue.GetArrayLength, AJSONObject.A[APropertyName].Count]));
|
||||
end;
|
||||
SetLength(lArr, AJSONObject.A[APropertyName].Count);
|
||||
lInnerType := lCtx.GetType(AValue.GetArrayElement(0).TypeInfo);
|
||||
BuildATValueArrayFromJSONArrayOfJSONObject;
|
||||
AValue := TValue.FromArray(ARTTIField.FieldType.Handle, lArr);
|
||||
end
|
||||
@ -2489,33 +2482,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
//procedure TMVCJsonDataObjectsSerializer.JSONObjectToNestedRecordFieldStatic(
|
||||
// const JSONObject: TJsonObject; RecordFieldRTTIType: TRttiField; const TypeOffset: Integer; );
|
||||
//var
|
||||
// lChildType: TRttiType;
|
||||
// lChildFieldOffset: Integer;
|
||||
// lKeyName: String;
|
||||
// lValue: TValue;
|
||||
//begin
|
||||
// if RecordFieldRTTIType.FieldType.TypeKind <> tkRecord then
|
||||
// begin
|
||||
// raise EMVCDeserializationException.Create('Only record type allowed');
|
||||
// end;
|
||||
//
|
||||
// //Recupero il tipo e l'offset
|
||||
// lChildType := RecordFieldRTTIType.FieldType;
|
||||
// lChildFieldOffset := RecordFieldRTTIType.Offset + TypeOffset;
|
||||
//
|
||||
// //recupero i campi
|
||||
// for var lField in lChildType.GetFields do
|
||||
// begin
|
||||
// lKeyName := TMVCSerializerHelper.GetKeyName(lField, lChildType);
|
||||
// lValue := lField.GetValue(Buffer + lChildFieldOffset);
|
||||
// JSONObjectPropertyToTValueForRecord(JSONObject, lKeyName, stFields, nil, lValue, nil, lField);
|
||||
// lField.SetValue(Buffer + lChildFieldOffset, lValue);
|
||||
// end;
|
||||
//end;
|
||||
|
||||
procedure TMVCJsonDataObjectsSerializer.ListToJsonArray(const AList: IMVCList; const AJsonArray: TJDOJsonArray;
|
||||
const AType: TMVCSerializationType; const AIgnoredAttributes: TMVCIgnoredList;
|
||||
const ASerializationAction: TMVCSerializationAction);
|
||||
@ -2527,7 +2493,9 @@ var
|
||||
lJSONValue: TJsonBaseObject;
|
||||
begin
|
||||
if not Assigned(AList) then
|
||||
begin
|
||||
raise EMVCSerializationException.Create('List not assigned');
|
||||
end;
|
||||
if Assigned(ASerializationAction) then
|
||||
begin
|
||||
lDict := TJDOLinks.Create;
|
||||
@ -2556,12 +2524,10 @@ begin
|
||||
else
|
||||
begin
|
||||
lJSONValue.Free;
|
||||
RaiseSerializationError('Invalid JSON Data Type');
|
||||
RaiseSerializationError('Invalid JSON Data Type: ' +
|
||||
GetEnumName(TypeInfo(TJsonDataType), Ord(lJsonDataType)));
|
||||
end
|
||||
end;
|
||||
|
||||
// InternalObjectToJsonObject(AList.GetItem(I), AJsonArray.AddObject, AType, AIgnoredAttributes, nil, nil,
|
||||
// nil);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -3780,28 +3746,6 @@ begin
|
||||
raise EMVCException.Create(HTTP_STATUS.BadRequest, lErrMsg);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
//
|
||||
// for var lField in lType.GetFields do
|
||||
// begin
|
||||
// lKeyName := TMVCSerializerHelper.GetKeyName(lField, lType);
|
||||
// lValue := lField.GetValue(@Result);
|
||||
// JSONObjectToRecord()()
|
||||
//// JSONObjectPropertyToTValueForRecord(JSONObject, lKeyName, stFields, nil, lValue, nil, lField);
|
||||
//// var lB: PByte;
|
||||
//// lB := PByte(@Result);
|
||||
//// JSONObjectToNestedRecordField(JSONObject, lField, lField.Offset, lB);
|
||||
// lField.SetValue(@Result, lValue);
|
||||
// end;
|
||||
end;
|
||||
|
||||
procedure TMVCJsonDataObjectsSerializer.JSONObjectToTValueForRecord(
|
||||
AJSONObject: TJSONObject; const AType: TMVCSerializationType;
|
||||
const AIgnored: TMVCIgnoredList; var ABuffer: PByte; var AValue: TValue;
|
||||
const ACustomAttributes: TArray<TCustomAttribute>);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function TMVCJsonDataObjectsSerializer.StrToRecord<T>(const AJSONString: String): T;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{ABDCF3F4-55C9-4C93-9DA7-7E7D35B0FE68}</ProjectGuid>
|
||||
<ProjectVersion>19.3</ProjectVersion>
|
||||
<ProjectVersion>19.4</ProjectVersion>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<MainSource>MVCAREntitiesGenerator.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
@ -1312,17 +1312,17 @@
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
|
@ -303,8 +303,6 @@ type
|
||||
[TestFixture]
|
||||
[Category('jsonrpc')]
|
||||
TJSONRPCServerTest = class(TObject)
|
||||
private
|
||||
procedure TestRequest_NoParams_DynamicArrayOfRecordAsResult;
|
||||
protected
|
||||
FExecutor: IMVCJSONRPCExecutor;
|
||||
FExecutor2: IMVCJSONRPCExecutor;
|
||||
@ -368,6 +366,8 @@ type
|
||||
procedure TestRequest_Echo_SingleRecordAsResult;
|
||||
[Test]
|
||||
procedure TestRequest_Echo_ComplexRecords;
|
||||
[Test]
|
||||
procedure TestRequest_NoParams_DynamicArrayOfRecordAsResult;
|
||||
end;
|
||||
|
||||
[TestFixture]
|
||||
@ -2965,7 +2965,7 @@ procedure TJSONRPCServerTest.TestRequest_Echo_ComplexRecords;
|
||||
var
|
||||
lReq: IJSONRPCRequest;
|
||||
lRPCResp: IJSONRPCResponse;
|
||||
lComplexRecIn, lComplexRec: TComplexRecordArray;
|
||||
lComplexRecIn, lComplexRecOut: TComplexRecordArray;
|
||||
begin
|
||||
lReq := TJSONRPCRequest.Create;
|
||||
lReq.Method := 'EchoArrayOfRecords';
|
||||
@ -2978,21 +2978,12 @@ begin
|
||||
|
||||
lReq.Params.Add(TValue.From<TComplexRecordArray>(lComplexRecIn), pdtArrayOfRecords);
|
||||
lRPCResp := FExecutor2.ExecuteRequest(lReq);
|
||||
Assert.IsFalse(lRPCResp.IsError, lRPCResp.Error.ErrMessage);
|
||||
Assert.IsFalse(lRPCResp.IsError, lRPCResp.AsJSONString);
|
||||
|
||||
TFile.WriteAllText('outputcomplexrecordarray.json', lRPCResp.ResultAsJSONArray.ToJSON(False));
|
||||
// lSimpleRec := TMVCRecordUtils.JsonObjectToRecord<TSimpleRecord>(lRPCResp.ResultAsJSONObject);
|
||||
// Assert.AreEqual(lSimpleRecIn.StringProperty, lSimpleRec.StringProperty);
|
||||
// Assert.AreEqual(lSimpleRecIn.IntegerProperty, lSimpleRec.IntegerProperty);
|
||||
// Assert.AreEqual(lSimpleRecIn.FloatProperty, lSimpleRec.FloatProperty);
|
||||
// Assert.AreEqual(lSimpleRecIn.CurrencyProperty, lSimpleRec.CurrencyProperty);
|
||||
// Assert.AreEqual(lSimpleRecIn.DateProperty, lSimpleRec.DateProperty);
|
||||
// Assert.AreEqual(lSimpleRecIn.TimeProperty, lSimpleRec.TimeProperty);
|
||||
// Assert.AreEqual(lSimpleRecIn.DateTimeProperty, lSimpleRec.DateTimeProperty, 0.000001);
|
||||
// Assert.AreEqual(lSimpleRecIn.BooleanProperty, lSimpleRec.BooleanProperty);
|
||||
// Assert.AreEqual(lSimpleRecIn.EnumProperty, lSimpleRec.EnumProperty);
|
||||
// Assert.IsTrue(lSimpleRecIn.SetProperty * lSimpleRec.SetProperty = [EnumItem1, EnumItem3]);
|
||||
// Assert.IsTrue(lSimpleRec.SetProperty - lSimpleRecIn.SetProperty = []);
|
||||
lComplexRecOut := TMVCRecordUtils.JSONArrayToArrayOfRecord<TComplexRecord>(lRPCResp.ResultAsJSONArray);
|
||||
lComplexRecIn[0].Equals(lComplexRecOut[0]);
|
||||
lComplexRecIn[1].Equals(lComplexRecOut[1]);
|
||||
end;
|
||||
|
||||
procedure TJSONRPCServerTest.TestRequest_Echo_SingleRecordAsResult;
|
||||
@ -3009,17 +3000,7 @@ begin
|
||||
lReq.Params.Add(TValue.From<TSimpleRecord>(lSimpleRecIn), pdtRecord);
|
||||
lRPCResp := FExecutor2.ExecuteRequest(lReq);
|
||||
lSimpleRec := TMVCRecordUtils.JsonObjectToRecord<TSimpleRecord>(lRPCResp.ResultAsJSONObject);
|
||||
Assert.AreEqual(lSimpleRecIn.StringProperty, lSimpleRec.StringProperty);
|
||||
Assert.AreEqual(lSimpleRecIn.IntegerProperty, lSimpleRec.IntegerProperty);
|
||||
Assert.AreEqual(lSimpleRecIn.FloatProperty, lSimpleRec.FloatProperty);
|
||||
Assert.AreEqual(lSimpleRecIn.CurrencyProperty, lSimpleRec.CurrencyProperty);
|
||||
Assert.AreEqual(lSimpleRecIn.DateProperty, lSimpleRec.DateProperty);
|
||||
Assert.AreEqual(lSimpleRecIn.TimeProperty, lSimpleRec.TimeProperty);
|
||||
Assert.AreEqual(lSimpleRecIn.DateTimeProperty, lSimpleRec.DateTimeProperty, 0.000001);
|
||||
Assert.AreEqual(lSimpleRecIn.BooleanProperty, lSimpleRec.BooleanProperty);
|
||||
Assert.AreEqual(lSimpleRecIn.EnumProperty, lSimpleRec.EnumProperty);
|
||||
Assert.IsTrue(lSimpleRecIn.SetProperty * lSimpleRec.SetProperty = [EnumItem1, EnumItem3]);
|
||||
Assert.IsTrue(lSimpleRec.SetProperty - lSimpleRecIn.SetProperty = []);
|
||||
Assert.IsTrue(lSimpleRecIn.Equals(lSimpleRec));
|
||||
end;
|
||||
|
||||
procedure TJSONRPCServerTest.TestRequest_NamedParams_S_I_ret_S;
|
||||
|
Loading…
Reference in New Issue
Block a user