Hi

Hi,

I'm thinking to create some kind of functionality to auto populate a record using fixed-dummy data so you can easy use it in tests

Just provided the record type and the result is the populate record.

DummyDataCreator := TDummyRecordCreator.Create ;
DummyRecordCreator.GenerateRecord(TDummyRecord)

some dummy values :
string = name of the record
integer = 100
double = 99.99
enumeration = value is first enumeration value
list.. array .. have 2 items

I have something like that in caché here is the caché example the output is in xml so you guys can understand it a bit ;-)

-----Class Definition------------
Class TestUnit.SHF.Mocking.DummyDataTranferObjectCreator.Generate.DataTransferObject Extends lib.DataTransferObject
{
Property String As %String;
Property Integer As %Integer;
Property Double As %Double;
Property List As %List;
Property ListOfDataTypes As %ListOfDataTypes;
Property ArrayOfDataTypes As %ArrayOfDataTypes;
Property Object As DataTransferObject;
Property ListOfObjects As DataTransferObjectList;
Property ArrayOfObjects As DataTransferObjectArray;
}
---Data Definition ----------------------------------
-- Code ------
set Creator = ##class(SHF.Mocking.DummyDataTranferObjectCreator).%New()
set Record = Creator.Generate("TestUnit.SHF.Mocking.DummyDataTranferObjectCreator.Generate.DataTransferObject")
-- Code ------
-- output----

  String
  100
  99.99
  List
 
    ListOfDataTypes_Value1
    ListOfDataTypes_Value2
 

 
    ArrayOfDataTypes_Value1
    ArrayOfDataTypes_Value2
 

 
    String
    100
    99.99
    List
   
      ListOfDataTypes_Value1
      ListOfDataTypes_Value2
   

   
      ArrayOfDataTypes_Value1
      ArrayOfDataTypes_Value2
   

 

 
   
      String
      100
      99.99
      List
     
        ListOfDataTypes_Value1
        ListOfDataTypes_Value2
     

     
        ArrayOfDataTypes_Value1
        ArrayOfDataTypes_Value2
     

   

   
      String
      100
      99.99
      List
     
        ListOfDataTypes_Value1
        ListOfDataTypes_Value2
     

     
        ArrayOfDataTypes_Value1
        ArrayOfDataTypes_Value2
     

   

 

 
   
      String
      100
      99.99
      List
     
        ListOfDataTypes_Value1
        ListOfDataTypes_Value2
     

     
        ArrayOfDataTypes_Value1
        ArrayOfDataTypes_Value2
     

   

   
      String
      100
      99.99
      List
     
        ListOfDataTypes_Value1
        ListOfDataTypes_Value2
     

     
        ArrayOfDataTypes_Value1
        ArrayOfDataTypes_Value2
     

   

 


------ output-----------

Or does someone know this allready exists. I hope this will be possible using RTTI or am I overrating delphi here ?

Comments