public string GetThingJson() { GetThingDTO thingDTO = GetThing(); string json = thingDTO.GetObjectJson(); return(json); }
private List <GetThingDTO> GetThingDTOs(int thingDTOsCount = 1, int subThingDTOsCount = 1) { var thingDTOs = new List <GetThingDTO>(); for (int i = 0; i < thingDTOsCount; i++) { var thingDto = new GetThingDTO(); thingDto.Id = Guid.NewGuid(); thingDto.Name = $"Name #{i}"; thingDto.Description = $"TO{new string('O', i)} MUCH LONG DESCRIPTION #{i}."; thingDto.Age = NumberHelper.GetRandomNumber(100); thingDto.SubThings = GetSubThingDTOs(subThingDTOsCount); thingDTOs.Add(thingDto); } return(thingDTOs); }
public static string GetObjectJson(this GetThingDTO thingDTO) { string jsonObject = JsonConvert.SerializeObject(thingDTO); return(jsonObject); }