simplify tests

This commit is contained in:
Ivan Hörler 2018-07-18 19:20:31 +02:00
parent d835495591
commit 6ff8631121
1 changed files with 4 additions and 2 deletions

View File

@ -32,11 +32,13 @@ namespace EHEC_Server
//// For parsing user defined class object //// For parsing user defined class object
//// To get all properties of object //// To get all properties of object
//// and then store object properties and their value in dictionary container //// and then store object properties and their value in dictionary container
var objectDataContainer = obj.GetType().GetProperties().ToDictionary(i => i.Name, i => i.GetValue(obj)); var objectDataContainer = obj.GetType();
var objectDataContainer1 = objectDataContainer.GetProperties();
var objectDataContainer2 = objectDataContainer1.ToDictionary(i => i.Name, i => i.GetValue(obj));
StringBuilder jsonfile = new StringBuilder(); StringBuilder jsonfile = new StringBuilder();
jsonfile.Append("{"); jsonfile.Append("{");
foreach (var data in objectDataContainer) foreach (var data in objectDataContainer2)
{ {
jsonfile.Append($"\"{data.Key}\":{Serialize(data.Value)},"); jsonfile.Append($"\"{data.Key}\":{Serialize(data.Value)},");
} }